o netbeans plugin

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@321198 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2005-10-14 19:55:48 +00:00
parent ffcedd9584
commit 0763faa1a0
10 changed files with 251 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -0,0 +1,251 @@
------
Guide to Using maven 2 in Netbeans 4.0 (4.1 and 5.0)
------
Raphaël Piéroni
------
Mon Aug 9 2005
------
Using maven 2 in Netbeans 4.0 (4.1 and 5.0)
This mini guide explain by examples howto use Maven 2 in Netbeans IDE.
To use Maven 2 in Netbeans you have to follow these steps:
* {{{#Retreive/Create the Maven 2 project}Retreive/Create the Maven 2 project.}}
* {{{#Launch Maven 2 in command line using the netbeans-freeform plugin}Launch Maven 2 in command line using the netbeans-freeform plugin.}}
* {{{#Open the project with Netbeans}Open the project with Netbeans.}}
* {{{#Build the project and launch other Maven goals}Build the project and launch other Maven goals.}}
* {{{#Edit properties of the plugin}Edit properties of the plugin.}}
* {{{#Refresh the project view}Refresh the project view.}}
* {{{#Build the Maven 2 site}Build the Maven 2 site.}}
* {Retreive/Create the Maven 2 project}
This guide assume the project is created using the archetype plugin.
You can also checkout the Maven 2 project using your versionning system.
-------------------
[maven-user@mini-guide examples]$ m2 archetype:create -DarchetypeArtifactId=maven-archetype-quickstart -DartifactId=demoquickstart -DgroupId=demoquickstart
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] ----------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [archetype:create] (aggregator-style)
[INFO] ----------------------------------------------------------------------------
[INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] **************************************************************
[INFO] Starting Jakarta Velocity v1.4
[INFO] RuntimeInstance initializing.
[INFO] Default Properties File: org/apache/velocity/runtime/defaults/velocity.properties
[INFO] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
[INFO] Resource Loader Instantiated: org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
[INFO] ClasspathResourceLoader : initialization starting.
[INFO] ClasspathResourceLoader : initialization complete.
[INFO] ResourceCache : initialized. (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
[INFO] Default ResourceManager initialization complete.
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Include
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
[INFO] Created: 20 parsers.
[INFO] Velocimacro : initialization starting.
[INFO] Velocimacro : adding VMs from VM library template : VM_global_library.vm
[ERROR] ResourceManager : unable to find resource 'VM_global_library.vm' in any resource loader.
[INFO] Velocimacro : error using VM library template VM_global_library.vm : org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'VM_global_library.vm'
[INFO] Velocimacro : VM library template macro registration complete.
[INFO] Velocimacro : allowInline = true : VMs can be defined inline in templates
[INFO] Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
[INFO] Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
[INFO] Velocimacro : messages on : VM system will output logging messages
[INFO] Velocimacro : autoload off : VM system will not automatically reload global library macros
[INFO] Velocimacro : initialization complete.
[INFO] Velocity successfully started.
[INFO] [archetype:create]
[INFO] Defaulting package to group ID: demoquickstart
[INFO] artifact org.apache.maven.archetypes:maven-archetype-quickstart: checking for updates from central
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating Archetype: maven-archetype-quickstart:RELEASE
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: demoquickstart
[INFO] Parameter: outputDirectory, Value: /demos/demoquickstart
[INFO] Parameter: packageName, Value: demoquickstart
[INFO] Parameter: package, Value: demoquickstart
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: artifactId, Value: demoquickstart
[INFO] ResourceManager : found archetype-resources/pom.xml with loader org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
[INFO] ********************* End of debug info from resources from generated POM ***********************
[INFO] ResourceManager : found archetype-resources/src/main/java/App.java with loader org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
[INFO] ResourceManager : found archetype-resources/src/test/java/AppTest.java with loader org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
[INFO] Archetype created in dir: /demos/demoquickstart
[INFO] ----------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ----------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Tue Oct 11 21:59:22 CEST 2005
[INFO] Final Memory: 3M/7M
[INFO] ----------------------------------------------------------------------------
-------------------
* {Launch Maven 2 in command line using the netbeans-freeform plugin}
After having retreived the Maven 2 project, you have to eneable the project to
be seen as a Netbeans 4.0, 4.1 or 5.0 project using the Netbeans Freeform project type.
To eneable the project, use the netbeans-freeform plugin for Maven 2.
-------------------
[maven-user@mini-guide demoquickstart]$ m2 netbeans-freeform:generate-netbeans-project
[INFO] Searching repository for plugin with prefix: 'netbeans-freeform'.
[INFO] ----------------------------------------------------------------------------
[INFO] Building Maven Quick Start Archetype
[INFO] task-segment: [netbeans-freeform:generate-netbeans-project]
[INFO] ----------------------------------------------------------------------------
[INFO] Preparing netbeans-freeform:generate-netbeans-project
[INFO] [netbeans-freeform:generate-netbeans-project]
[INFO] JarAnalyser found
[INFO] The project 'Maven Quick Start Archetype' is analysed.
[INFO] The file 'nbproject/project.xml' is created.
[INFO] The file 'nbproject/mavencall.xml' is created.
[INFO] The file 'nbproject/project.properties' is created.
[INFO] ----------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ----------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Tue Oct 11 22:12:30 CEST 2005
[INFO] Final Memory: 1M/3M
[INFO] ----------------------------------------------------------------------------
-------------------
The netbeans-freeform plugin creates one directory and three files by reading the Maven 2 project descriptor:
* The <<<nbproject>>> directory holds the Netbeans project descriptor.
* The <<<<project.xml>>> file is the Netbeans Freeform project descriptor.
* The <<<mavencall.xml>>> holds the Ant calls which execute Maven 2, as Netbeans uses Ant as its build tool.
* The <<<project.properties>>> files holds the two properties: <<<local.repository>>>
which is the absolute path to the Maven 2 local repository and <<<project.directory>>>
which is the absolute path to the project directory.
* {Open the project with Netbeans}
Now that the Maven 2 project is eneabled for use in Netbeans, open your Netbeans IDE.
Then open the project (Ctrl+Maj+O).
Here is the <Open Project> window.
[Open_Project.png] Open Project
And here are:
The <Projects Window> with the opened project.
[Project_Opened.png] Project Opened
The project's <Context Menu> of the opened project.
[Context_Menu.png] Context Menu
And the <Files Window> with the opened project.
[Window_Files.png] Files Window
* {Build the project and launch other Maven goals}
It is now time to try the first execution of Maven 2 from within Netbeans.
Try the <Build Main Project> Netbeans action (F11).
You see the Maven 2 execution of the <<<package>>> lifecycle goal.
[Run_Build_Main_Project.png] Run Build Main Project
You can also call the <Clean Project> Netbeans action which is mapped to the <<<clean:clean>>> Maven2 goal.
[Run_Clean_Main_Project.png] Run Clean Main Project
* {Edit properties of the plugin}
Now you can add some additionnal views in your <Projects> window in Netbeans.
Like an additionnal goal in the context menu.
-------------------
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>demoquickstart</groupId>
<artifactId>demoquickstart</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Maven Quick Start Archetype</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>netbeans-freeform-maven-plugin</artifactId>
<configuration>
<additionalGoals>source:jar</additionalGoals>
</configuration>
</plugin>
</plugins>
</build>
</project>
-------------------
You can also configure some additionnal files and folders in the <Projects> window.
The last option is to create the <<<nbproject>>> folder and its content in another directory than in the Maven 2 project's one.
The full configuration can be found at {{http://mojo.codehaus.org/netbeans-freeform-maven-plugin}}.
* {Refresh the project view}
To refresh the Project view in Netbeans accordingly to the new configuration added to the Maven 2 project descriptor.
Just right-clic the project in the Projects window and choose the <Refresh Project> action.
[Refresh_Project.png] Refresh Project
Here is the resulting refreshed Context Menu.
[Refreshed_Context_Menu.png] Refreshed Context Menu
* {Build the Maven 2 site}
You can call The <Generate Javadoc for Project> Netbeans action which is mapped to the <<<site:site>>> Maven 2 goal,
here in the Maven site archetype.
[Generate_Site.png] Generate Site