blob: 583187f2c2a71b4d7edd7a7fb2bf96acabd37d3f [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>NetBeans Platform Maven Command Line Tutorial</title>
<link rel="stylesheet" type="text/css" href="https://netbeans.org/netbeans.css"/>
<meta name="AUDIENCE" content="NBUSER"/>
<meta name="TYPE" content="ARTICLE"/>
<meta name="EXPIRES" content="N"/>
<meta name="indexed" content="y"/>
<meta name="description"
content="This tutorial demonstrates how to create a simple NetBeans Platform application and module from a command line prompt using the Maven build framework."/>
<!-- Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. -->
<!-- Use is subject to license terms.-->
</head>
<body>
<h1>NetBeans Platform Maven Command Line Tutorial</h1>
<p>Welcome to the <a href="https://platform.netbeans.org/"><b>NetBeans Platform</b></a>!</p>
<p>This document demonstrates how to create a
NetBeans Platform application and module from a command line prompt using the Maven build framework.
To create this application you do not need to install or use the NetBeans IDE.
You will need to create and edit some files, but you can use a simple text editor.
However, an IDE can be very helpful when performing tasks such as editing the POM and managing dependencies.</p>
<p>In this tutorial you will see that after you install Maven, you can specify goals and parameters
and execute Maven goals from the command line prompt to create and build projects.
The IDE performs the same task, but provides an interface that simplifies the task of specifying
the parameters for creating projects.</p>
<p><b>Contents</b></p>
<ul class="toc">
<li><a href="#01">Creating the NetBeans Platform Application</a></li>
<li><a href="#02">Installing and Running the NetBeans Platform Application</a></li>
<li><a href="#03">Creating a NetBeans Module from an Archetype</a></li>
<li><a href="#04">Adding the New NetBeans Module as a Dependency</a></li>
<li><a href="#05">Building the NetBeans Platform Application With the New NetBeans Module</a></li>
</ul>
<p><b>To follow this tutorial, you need the software and resources listed in the following table.</b></p>
<table>
<tbody>
<tr>
<th class="tblheader" scope="col">Software or Resource</th>
<th class="tblheader" scope="col">Version Required</th>
</tr>
<tr>
<td class="tbltd1"><a href="http://java.sun.com/javase/downloads/index.jsp">Java Developer Kit (JDK)</a></td>
<td class="tbltd1">version 6 or above</td>
</tr>
<tr>
<td class="tbltd1"><a href="http://maven.apache.org/">Maven</a></td>
<td class="tbltd1">version 3.0.3 or higher,
though 2.x versions may still work.</td>
</tr>
</tbody>
</table>
<p>Before starting this tutorial you may want to familiarize yourself with
the following documentation.</p>
<ul><li><a href="http://maven.apache.org/guides/mini/guide-configuring-maven.html">Maven - Guide to Configuring Maven</a></li>
<li><a href="http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html">Maven in 5 Minutes</a></li>
<li><a href="http://www.sonatype.com/books/maven-book/reference/introduction.html">Chapter 1. Introducing Apache Maven</a>
(from <a href="http://www.sonatype.com/books/maven-book/reference/public-book.html">Maven: The Definitive Guide</a>)</li>
</ul>
<!-- =================================================================== -->
<!-- +++++++++++++++ Creating the Application ++++++++++++++++++++++++++ -->
<h2><a name="01"></a>Creating the NetBeans Platform Application</h2>
<p>In this exercise you will execute the Maven goal <tt>generate</tt> from the command line to generate
a new NetBeans Platform application from an archetype in the codehaus.org repository.
In the command you will specify the parameters that will be used when Maven generates the application.</p>
<div class="indent">
<ol>
<li>Install <a href="http://maven.apache.org/">Maven</a>.</li>
<li>Open a command line terminal.</li>
<li>Test your Maven installation by typing the following command.
<pre class="examplecode">mvn -version</pre>
<p>After you type the command you will see details about the Maven installation,
including the version of Maven and the JDK, such as the following:</p>
<pre class="examplecode">Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
Maven home: C:\Users\Geertjan\Desktop\apache-maven-3.0.4\bin\..
Java version: 1.7.0_06, vendor: Oracle Corporation
Java home: c:\Program Files\Java\jdk1.7.0_06\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"</pre></li>
<li>Navigate to the directory where you want to create the NetBeans Platform application.</li>
<li>Type the following command, on a single line, in a terminal window
(also known as the command prompt):
<pre class="examplecode">mvn
-DarchetypeGroupId=org.codehaus.mojo.archetypes
-DarchetypeArtifactId=netbeans-platform-app-archetype
-DarchetypeVersion=1.12
archetype:generate</pre>
<p class="tips">Here it is on a single line:</p>
<pre class="examplecode">mvn -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=netbeans-platform-app-archetype -DarchetypeVersion=1.12 archetype:generate</pre>
</li>
<li><p>When prompted, enter the following values:</p>
<ul>
<li>groupId: <tt>com.mycompany</tt></li>
<li>artifactId: <tt>mavenPlatformApp</tt></li>
<li>version: &lt;press Enter to accept the default&gt;</li>
<li>package: &lt;press Enter to accept the default&gt;</li>
<li>netbeansVersion: <tt>RELEASE72</tt></li>
</ul>
<!-- <pre class="examplecode">mvn -DarchetypeVersion=1.10
-Darchetype.interactive=false
-DgroupId=com.mycompany
-DarchetypeArtifactId=<strong>netbeans-platform-app-archetype</strong>
-DarchetypeRepository=http://repository.codehaus.org/
-Dversion=1.0-SNAPSHOT
-DarchetypeGroupId=org.codehaus.mojo.archetypes
-Dpackage=com.mycompany.mavenplatformapp
-DartifactId=mavenPlatformApp
--batch-mode org.apache.maven.plugins:maven-archetype-plugin:2.1:generate</pre>
<p>Here is the same command on one line:</p>
<pre class="examplecode">mvn -DarchetypeVersion=1.10 -Darchetype.interactive=false -DgroupId=com.mycompany -DarchetypeArtifactId=<strong>netbeans-platform-app-archetype</strong> -DarchetypeRepository=http://repository.codehaus.org/ -Dversion=1.0-SNAPSHOT -DarchetypeGroupId=org.codehaus.mojo.archetypes -Dpackage=com.mycompany.mavenplatformapp -DartifactId=mavenPlatformApp --batch-mode org.apache.maven.plugins:maven-archetype-plugin:2.1:generate</pre>
--> </li>
</ol>
</div>
<p>You can see that the command specifies the archetype that Maven will use to create
the NetBeans Platform application (<a href="http://search.maven.org/#search|ga|1|netbeans-platform-app-archetype"><tt>netbeans-platform-app-archetype</tt></a>).
The command also specifies the location of the repository for the archetype (<tt>http://repository.codehaus.org/</tt>)
and the version (<tt>1.12</tt>) and GroupId (<tt>org.codehaus.mojo.archetypes</tt>) of the archetype.</p>
<p>When you run the command, Maven will automatically retrieve the archetype and create the project according to
the details specified in the command (artifact id, version, package).</p>
<p class="notes"><strong>Note.</strong> When you use NetBeans IDE to create a
Mavenized NetBeans Platform application,
the IDE executes a Maven goal with the same parameters.</p>
<p class="tips">For more information about the plugin that is used to generate the artifacts,
see the documentation on the <a href="http://mojo.codehaus.org/nbm-maven-plugin/">nbm-maven-plugin</a>.</p>
<p>When you run the command, you will see output similar to the following in the terminal window.</p>
<pre class="examplecode">[INFO] Parameter: groupId, Value: my.company
[INFO] Parameter: artifactId, Value: mavenPlatformApp
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: my.company
[INFO] Parameter: packageInPathFormat, Value: my/company
[INFO] Parameter: package, Value: my.company
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: netbeansVersion, Value: RELEASE72
[INFO] Parameter: groupId, Value: my.company
[INFO] Parameter: artifactId, Value: mavenPlatformApp
[INFO] project created from Archetype in dir: C:\Users\Geertjan\demo\mavenPlatformApp
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:12.333s
[INFO] Finished at: Sat Sep 15 23:26:09 CEST 2012
[INFO] Final Memory: 16M/132M</pre>
<p>If you look in the root directory <tt>mavenPlatformApp</tt> that was created,
you can see that the new project contains a <tt>pom.xml</tt> file and a directory for each of the default sub-modules of the archetype: application and branding. <br/>
</p><p><img src="../images/tutorials/maven-commandline/72/p1.png" alt="Screenshot of structure of mavenPlatformApp" title="Screenshot of structure of mavenPlatformApp" />
</p>
<p>If you open <tt>pom.xml</tt> for mavenPlatformApp in an editor, you will see that the
POM specifies all the details required for building the application:</p>
<pre class="examplecode">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;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/xsd/maven-4.0.0.xsd"&gt;
&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
&lt;groupId&gt;my.company&lt;/groupId&gt;
&lt;artifactId&gt;mavenPlatformApp-parent&lt;/artifactId&gt;
&lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
&lt;packaging&gt;pom&lt;/packaging&gt;
&lt;name&gt;mavenPlatformApp-parent&lt;/name&gt;
&lt;repositories&gt;
&lt;!--
Repository hosting NetBeans modules, especially APIs.
Versions are based on IDE releases, e.g.: RELEASE691
To create your own repository, use: nbm:populate-repository
--&gt;
&lt;repository&gt;
&lt;id&gt;netbeans&lt;/id&gt;
&lt;name&gt;NetBeans&lt;/name&gt;
&lt;url&gt;http://bits.netbeans.org/maven2/&lt;/url&gt;
&lt;/repository&gt;
&lt;/repositories&gt;
&lt;build&gt;
&lt;pluginManagement&gt;
&lt;plugins&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
&lt;artifactId&gt;nbm-maven-plugin&lt;/artifactId&gt;
&lt;version&gt;3.8&lt;/version&gt;
&lt;extensions&gt;true&lt;/extensions&gt;
&lt;configuration&gt;
&lt;brandingToken&gt;${brandingToken}&lt;/brandingToken&gt;
&lt;cluster&gt;${brandingToken}&lt;/cluster&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
&lt;plugin&gt;
&lt;!-- NetBeans 6.9+ requires JDK 6 --&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
&lt;version&gt;2.5.1&lt;/version&gt;
&lt;configuration&gt;
&lt;source&gt;1.6&lt;/source&gt;
&lt;target&gt;1.6&lt;/target&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
&lt;version&gt;2.4&lt;/version&gt;
&lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/pluginManagement&gt;
&lt;/build&gt;
&lt;modules&gt;
&lt;module&gt;branding&lt;/module&gt;
&lt;module&gt;application&lt;/module&gt;
&lt;/modules&gt;
&lt;properties&gt;
&lt;netbeans.version&gt;RELEASE72&lt;/netbeans.version&gt;
&lt;brandingToken&gt;mavenplatformapp&lt;/brandingToken&gt;
&lt;/properties&gt;
&lt;/project&gt;</pre>
<p class="tips">If you look at the <tt>&lt;properties&gt;</tt> element, you can see that the version of the NetBeans Platform is
specified as <tt>RELEASE72</tt>. In the POM of your sub-modules, you can specify <tt>${netbeans.version}</tt> as the version
and the module will use the version specified in the parent POM project.
The enables you to easily update the NetBeans Platform version for all the project's sub-modules.</p>
<!-- =================================================================== -->
<!-- ++++++++++++++++ Running the Application ++++++++++++++++++++++++++ -->
<h2><a name="02"></a>Installing and Running the NetBeans Platform Application</h2>
<p>In this exercise you will run the Maven <tt>install</tt> goal from the command line to build the application and copy
the artifacts in your local repository.
The NetBeans Platform application is a multi-module application.
You will use the reactor mechanism in Maven to build the application project and the project's dependencies.
After you build the application you will execute the <tt>run-platform</tt> goal to launch the application.</p>
<div class="indent">
<ol>
<li>Navigate to the <tt>mavenPlatformApp</tt> directory and type the following command to
build the project:
<pre class="examplecode">mvn install</pre>
<p class="tips">The above command will take some time to complete. When the command
completes, you will see the following:</p>
<pre class="examplecode">[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] mavenPlatformApp-parent ........................... SUCCESS [0.533s]
[INFO] mavenPlatformApp-branding ......................... SUCCESS [8.684s]
[INFO] mavenPlatformApp-app .............................. SUCCESS [33.900s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:31.177s
[INFO] Finished at: Sat Sep 15 23:36:18 CEST 2012
[INFO] Final Memory: 18M/59M
[INFO] ------------------------------------------------------------------------</pre>
</li>
<li>After the command above completes, navigate to the <tt>application</tt> directory and type the following command to launch the application.
<pre class="examplecode">mvn nbm:run-platform</pre>
</li>
</ol>
</div>
<p>When you run the <tt>nbm-maven-plugin</tt> with the <tt>run-platform</tt> goal, as done above, Maven will
launch your NetBeans Platform application:</p>
<p>
<img src="../images/tutorials/maven-commandline/72/p2.png" alt="Screenshot of default application" title="Screenshot of default application" class="margin-around b-all" />
</p>
<p>Browse through the menus to see what your new application consists of. Open
some windows, undock some of them, and you will have something that looks like this:</p>
<p>
<img src="../images/tutorials/maven-commandline/72/p3.png" alt="Screenshot of default application" title="Screenshot of default application" class="margin-around b-all" />
</p>
<p>You have now successfully created and launched your NetBeans Platform application.
The default branding elements are located in the <tt>branding</tt> sub-module that was generated according to the archetype.
The NetBeans IDE provides tools and wizards that can help you to modify the branding elements.</p>
<p>In the next section you will create a new module for the application.</p>
<!-- =================================================================== -->
<!-- ++++++++++++++++++ Creating a new Module ++++++++++++++++++++++++++ -->
<h2><a name="03"></a>Creating a NetBeans Module from an Archetype</h2>
<p>You will now create a new module that is named mavenPlatformModuleA in the <tt>mavenPlatformApp</tt> directory.
In the same way that you created the NetBeans Platform application,
you will run a Maven command from the command line and use the module archetype <tt>nbm-archetype</tt>.</p>
<p>After you create the module, you will use a text editor to create a simple class in the module.
You will then build the module to install the module in the local repository.</p>
<div class="indent">
<ol>
<li>Navigate to the <tt>mavenPlatformApp</tt> directory in the command line
terminal and run the following command:
<pre class="examplecode">mvn
-DarchetypeGroupId=org.codehaus.mojo.archetypes
-DarchetypeArtifactId=nbm-archetype
-DarchetypeVersion=1.11
archetype:generate</pre>
<p class="tips">Here it is on a single line:</p>
<pre class="examplecode">mvn -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=nbm-archetype -DarchetypeVersion=1.11 archetype:generate</pre>
</li>
<li><p>When prompted, enter the following values:</p>
<ul>
<li>groupId: <tt>com.mycompany</tt></li>
<li>artifactId: <tt>mavenPlatformModuleA</tt></li>
<li>version: &lt;press Enter to accept the default&gt;</li>
<li>package: <tt>com.mycompany.mavenplatformmodulea</tt></li>
<li>netbeansVersion: <tt>RELEASE72</tt></li>
</ul>
<p>You can see that the command specifies <tt><a href="http://search.maven.org/#search%7Cga%7C1%7Cnbm-archetype">nbm-archetype</a></tt>.
The archetype will be retrieved from the remote repository.</p>
<p>When you run the command, you will see output similar to the following in the
terminal window:</p>
<pre class="examplecode">[INFO] Parameter: groupId, Value: com.mycompany
[INFO] Parameter: artifactId, Value: mavenPlatformModuleA
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: com.mycompany.mavenplatformmodulea
[INFO] Parameter: packageInPathFormat, Value: com/mycompany/mavenplatformmodulea
[INFO] Parameter: package, Value: com.mycompany.mavenplatformmodulea
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: netbeansVersion, Value: RELEASE72
[INFO] Parameter: groupId, Value: com.mycompany
[INFO] Parameter: artifactId, Value: mavenPlatformModuleA
[INFO] project created from Archetype in dir: C:\Users\Geertjan\demo\mavenPlatformApp\mavenPlatformModuleA
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] mavenPlatformApp-parent ........................... SUCCESS [58.613s]
[INFO] mavenPlatformApp-branding ......................... SKIPPED
[INFO] mavenPlatformApp-app .............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:00.058s
[INFO] Finished at: Sat Sep 15 23:52:13 CEST 2012
[INFO] Final Memory: 19M/131M
[INFO] ------------------------------------------------------------------------</pre>
<p>If you look at the contents of the <tt>mavenPlatformApp</tt> directory, you will see that the directory
contains a new directory that is named <tt>mavenPlatformModuleA</tt>.
The new directory contains a <tt>src</tt> directory and <tt>pom.xml</tt>.
The file <tt>bundle.properties</tt> is generated in the
<tt>resources/com/mycompany/mavenplatformmodulea</tt> directory:</p>
</p><p><img src="../images/tutorials/maven-commandline/72/p4.png" alt="Screenshot of structure of mavenplatformmodulea" title="Screenshot of structure of mavenplatformmodulea" />
<p>In the next step you will create a class in the
<tt>java/com/mycompany/mavenplatformmodulea</tt> directory.</p>
</li>
<li>Edit the new module's <tt>pom.xml</tt> to make the following changes (in bold) to add a dependency on
the modules you are referring to in the code above.
<pre class="examplecode">&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.netbeans.api&lt;/groupId&gt;
&lt;artifactId&gt;org-netbeans-api-annotations-common&lt;/artifactId&gt;
&lt;version&gt;RELEASE72&lt;/version&gt;
&lt;/dependency&gt;
<b>&lt;dependency&gt;
&lt;groupId&gt;org.netbeans.api&lt;/groupId&gt;
&lt;artifactId&gt;org-openide-util&lt;/artifactId&gt;
&lt;version&gt;RELEASE72&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.netbeans.api&lt;/groupId&gt;
&lt;artifactId&gt;org-openide-awt&lt;/artifactId&gt;
&lt;version&gt;RELEASE72&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.netbeans.api&lt;/groupId&gt;
&lt;artifactId&gt;org-openide-dialogs&lt;/artifactId&gt;
&lt;version&gt;RELEASE72&lt;/version&gt;
&lt;/dependency&gt;</b>
&lt;/dependencies&gt;</pre>
</li>
<li>Use a text editor to create the following class <tt>HelloWorldActionListener.java</tt>
in the <tt>java/com/mycompany/mavenplatformmodulea</tt> directory.
<pre class="examplecode">package com.mycompany.mavenplatformmodulea;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionRegistration;
import org.openide.util.NbBundle.Messages;
@ActionID(category = "Window",
id = "com.mycompany.mavenproject2.HelloWorldActionListener")
@ActionRegistration(displayName = "#CTL_HelloWorldActionListener")
@ActionReference(path = "Menu/Window", position = 0)
@Messages("CTL_HelloWorldActionListener=Hello World")
public final class HelloWorldActionListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
NotifyDescriptor d = new NotifyDescriptor.Message("hello...");
DialogDisplayer.getDefault().notify(d);
}
}</pre>
</li>
<li>On the command line, navigate to the <tt>mavenPlatformModuleA</tt> directory and
run the following command to build and install the module in the local repository.
<pre class="examplecode">mvn install</pre>
<p>When you run the <tt>install</tt> command, Maven builds the module and copies the JAR and NBM artifacts to the
local repository.</p>
</li>
</ol>
</div>
<p>Now that the artifact is in the local repository, you can add the artifact
as a dependency of the NetBeans Platform application, as shown in
the next section.</p>
<!-- =================================================================== -->
<!-- ++++++++++++++ Adding the Module as a Dependency ++++++++++++++++++ -->
<h2><a name="04"></a>Adding the New NetBeans Module as a Dependency</h2>
<p>In this section you will add the module as a dependency of the NetBeans Platform
application by declaring the dependency in the POM of the application project.</p>
<div class="indent">
<ol>
<li>Open the <tt>pom.xml</tt> file in the <tt>application</tt> directory in a text editor.</li>
<li>Declare the mavenPlatformModuleA module as
a dependency of the application by making the following changes (in bold) to the POM.
<pre class="examplecode">&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.netbeans.cluster&lt;/groupId&gt;
&lt;artifactId&gt;platform&lt;/artifactId&gt;
&lt;version&gt;${netbeans.version}&lt;/version&gt;
&lt;type&gt;pom&lt;/type&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;${project.groupId}&lt;/groupId&gt;
&lt;artifactId&gt;mavenPlatformApp-branding&lt;/artifactId&gt;
&lt;version&gt;${project.version}&lt;/version&gt;
&lt;/dependency&gt;
<b>&lt;dependency&gt;
&lt;groupId&gt;com.mycompany&lt;/groupId&gt;
&lt;artifactId&gt;mavenPlatformModuleA&lt;/artifactId&gt;
&lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
&lt;/dependency&gt;</b>
&lt;!-- NbModuleSuite functional in RELEASE70 or later: --&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.netbeans.api&lt;/groupId&gt;
&lt;artifactId&gt;org-netbeans-modules-nbjunit&lt;/artifactId&gt;
&lt;version&gt;${netbeans.version}&lt;/version&gt;
&lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;
&lt;!-- To use Jelly Tools in your functional tests, add or replace with:
&lt;dependency&gt;
&lt;groupId&gt;org.netbeans.api&lt;/groupId&gt;
&lt;artifactId&gt;org-netbeans-modules-jellytools-platform&lt;/artifactId&gt;
&lt;version&gt;${netbeans.version}&lt;/version&gt;
&lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;
--&gt;
&lt;/dependencies&gt;</pre>
</li>
</ol>
</div>
<!-- =================================================================== -->
<!-- +++++++++++++++ Building the Application ++++++++++++++++++++++++++ -->
<h2><a name="05"></a>Building the NetBeans Platform Application With the New NetBeans Module</h2>
<p>You are now almost ready to launch the NetBeans Platform application with the new module installed.
You first need to make sure that the new module is specified as a module of the parent POM project.
You can then repeat the steps to build and launch the application.</p>
<div class="indent">
<ol>
<li>Open the <tt>pom.xml</tt> in the <tt>mavenPlatformApp</tt> directory in a text editor.</li>
<li>Confirm that the new module is specified in the list of modules that are included with the application.
<pre class="examplecode">
&lt;modules&gt;
&lt;module&gt;branding&lt;/module&gt;
&lt;module&gt;application&lt;/module&gt;
<strong>&lt;module&gt;mavenPlatformModuleA&lt;/module&gt;</strong>
&lt;/modules&gt;</pre>
</li>
<li>Navigate to the <tt>mavenPlatformApp</tt> directory in the command line terminal and
type the following command to build the project.
<pre class="examplecode">mvn install</pre>
<p>When you run the command, you can see that the new module is included
in the list of modules.</p>
<pre class="examplecode">[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] mavenPlatformApp-parent ........................... SUCCESS [0.144s]
[INFO] mavenPlatformApp-branding ......................... SUCCESS [2.044s]
[INFO] mavenPlatformModuleA .............................. SUCCESS [0.491s]
[INFO] mavenPlatformApp-app .............................. SUCCESS [7.790s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.724s
[INFO] Finished at: Sun Sep 16 00:00:00 CEST 2012
[INFO] Final Memory: 16M/226M
[INFO] ------------------------------------------------------------------------</pre>
</li>
<li>Navigate to the <tt>application</tt> directory and type the following command to launch the application.
<pre class="examplecode">mvn nbm:run-platform</pre>
<p>When you run the command, Maven will launch the application with the new module.</p>
</li>
</ol>
</div>
<p>You have now successfully added a new module to the application and launched the application.
To confirm that the module was loaded when the application launched,
choose Window &gt; Hello World from the main menu of the application to display the
greeting:<br/>
<img src="../images/tutorials/maven-commandline/72/p5.png" alt="Screenshot of Message Dialog" title="Screenshot of Message Dialog" />
<img src="../images/tutorials/maven-commandline/72/p6.png" alt="Screenshot of Message Dialog" title="Screenshot of Message Dialog" />
</p>
<!-- =================================================================== -->
<p>This tutorial demonstrated how you can use the Maven command line to create NetBeans
Platform applications.
For more examples on how to build NetBeans Platform applications and modules,
see the tutorials listed in the <a href="https://netbeans.org/kb/trails/platform.html">NetBeans Platform Learning Trail</a>.</p>
<!-- ======================================================================================== -->
<div class="feedback-box"><a name="feedback"></a>
<a href="https://netbeans.org/about/contact_form.html?to=3&amp;subject=Feedback:%20NetBeans%20Platform%20Application%20from%20Maven%20Archetypes%207.1">
Send Us Your Feedback</a></div>
<p>&nbsp;</p>
<!-- ======================================================================================== -->
<h2><a name="nextsteps"></a>See Also</h2>
<p>This document described
how to use the Maven build framework to create a new NetBeans Platform application without using NetBeans IDE.
For more information about creating and developing applications, see the following resources.</p>
<ul>
<li><a href="https://platform.netbeans.org/tutorials/nbm-maven-quickstart.html">NetBeans Platform Quick Start Using Maven</a></li>
<li><a href="https://netbeans.org/kb/trails/platform.html">NetBeans Platform Learning Trail</a></li>
<li><a href="http://bits.netbeans.org/dev/javadoc/">NetBeans API Javadoc</a></li>
</ul>
<p>If you have any questions about the NetBeans Platform, feel free
to write to the mailing list, dev@platform.netbeans.org, or view the
<a href="https://netbeans.org/projects/platform/lists/dev/archive">NetBeans Platform mailing list archive</a>.</p>
<!-- ======================================================================================== -->
</body>
</html>