blob: 07f07bfee5560d30a73b137f6e7e909fd2af9090 [file] [log] [blame]
<!DOCTYPE html>
<html class="no-js" lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Apache NetBeans Maven Utilities - NBM Maven Plugin &#x2013; Maven 2 NBM Plugin</title>
<link rel="stylesheet" href="./css/netbeans.css" />
<link href="https://fonts.googleapis.com/css?family=Lato:400,700" rel="stylesheet">
</head>
<body>
<div class="top-bar" id="responsive-menu">
<div class='top-bar-left'>
<a class='title' href="http://netbeans.apache.org"><img src='/images/apache-netbeans.svg' style='padding: 8px; height: 48px;'>Apache NetBeans (incubating)</a>
</div>
<div class="top-bar-right">
<ul class="vertical medium-horizontal menu" style="right: 90px;" data-responsive-menu="drilldown medium-dropdown">
<li> <a href="../nb-repository/index.html">NB Repository Plugin</a> </li>
<li> <strong style='line-height: 1;margin-bottom: 0;padding: 0.7rem 1rem;display: block;' >NBM Plugin</strong> </li>
<li> <a href="../shared/index.html">Shared</a> </li>
<li> <a href="../parent/index.html">Parent</a> </li>
</ul>
</div>
</div>
<div class='grid-container main-content'>
<div id="toc" class="toc">
<div id="toctitle">Overview</div>
<ul class="sectlevel1">
<li><a href="index.html">Usage</a></li>
<li><a href="plugin-info.html">Plugin Goals</a></li>
</ul>
<div id="toctitle">HOWTOs</div>
<ul class="sectlevel1">
<li><a href="buildinstexample.html">Customize installers</a></li>
<li><a href="upgrade.html">Upgrade from older versions</a></li>
</ul>
<div id="toctitle">Deprecated</div>
<ul class="sectlevel1">
<li><a href="nbm.html">Descriptor Format</a></li>
<li><a href="descriptor.html">Example Descriptor</a></li>
</ul>
</div>
<div id="preamble">
<div class="sectionbody">
<div class="section">
<h2><a name="HOW_TO:_Migrate_from_older_version_of_the_plugin"></a>HOW TO: Migrate from older version of the plugin</h2>
<p><a href="#Upgrading_to_3.9"> Upgrading to 3.9</a></p>
<p><a href="#Upgrading_to_3.8"> Upgrading to 3.8</a></p>
<p><a href="#Upgrading_from_2.6_version_to_3.0"> Upgrading from 2.6 to 3.0</a></p>
<p><a href="#Upgrading_from_2.4_version_to_2.5"> Upgrading from 2.4 to 2.5</a></p></div>
<div class="section">
<h2><a name="Upgrading_to_3.9">Upgrading to 3.9</a></h2>
<p>In 3.9, the <tt>populate-repository</tt> goal is moved to separate plugin.</p></div>
<div class="section">
<h2><a name="Upgrading_to_3.8">Upgrading to 3.8</a></h2>
<p>In 3.8 the <tt>descriptor</tt> parameter is deprecated and is replaced by equivalent plugin parameters. The values from descriptor are still applied, warnings are printed. In future releases the parameter will be removed.</p></div>
<div class="section">
<h2><a name="Upgrading_from_2.6_version_to_3.0">Upgrading from 2.6 version to 3.0</a></h2>
<p>There are a few significant incompatible changes introduced in <b>3.0's</b> version of NBM packaging lifecycle. The result should be easier to setup builds and better support for building NetBeans platform based applications.</p>
<ul>
<li>The lifecycle mappings have changed. There is no more <tt>nbm:jar</tt> goal and it was replaced by <tt>nbm:manifest</tt> which is executed at different phase, namely <tt>process-classes</tt>, right after the module's classes are compiled.</li></ul>
<p><b>Important</b>: In order to have maven-jar-plugin to pick up the generated manifest, you need to add the following configuration snippet to your projects with <tt>nbm</tt> packaging.</p>
<div class="source">
<pre> &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;3.0.2&lt;/version&gt;
&lt;configuration&gt;
&lt;archive&gt;
&lt;manifestFile&gt;${project.build.outputDirectory}/META-INF/MANIFEST.MF&lt;/manifestFile&gt;
&lt;/archive&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;</pre></div>
<ul>
<li>The project's dependencies that shall end up on <b>Class-Path</b> of the module and now processed transitively. In earlier versions, you had to either explicitly list all such items in the pom as direct dependencies, or list them in the module descriptor. Only transitive dependencies that descend from non-NetBeans module direct dependencies are included, eg. if you depend on module that includes Apache's commons-httpclient, the library will not be included (unless defined in your project directly). Possible trouble makers are transitive depedencies that are defined both in a dependening module and a regular jar dependency. Based on Maven dependency tree resolution, the binary could end up on the <b>Class-Path</b> or not. The resolution to the problem is to define The troubled dependency directly and either define the scope as <tt>provided</tt> if you don't want it included in <b>Class-Path</b>, or keep the default <tt>compile</tt> scope if you want.</li>
<li>NBM file is always generated for any NetBeans module project. You can skip the NBM file generation by setting the parameter to nbm:nbm goal, but please be aware that having NBM files in local and remote repositories is crucial for the new tools that create a NetBeans Platform based application binaries.</li>
<li>In previous versions the ultimate final binary for the platform based application, was a directory with the cluster(s) of modules. Now a new packaging is defined <tt>nbm-application</tt> that allows for creating a final application zip file, webstartable jnlp files, and an update site. All are constructed solely from the repository content (assuming all relevant modules have NBM files in repositories) and the primary project for the binaries is the <tt>nbm-application</tt> packaging project, unlike in previous versions where the root pom was the primary project and required all included modules to be built as part of the reactor in the same build.</li>
<li>The <tt>nbm:manifest</tt> goal besides generating the manifest, will also check if the runtime dependencies match the actual classes being used in the project and it's libraries on <b>Class-Path</b>. That's analogous to the <a class="externalLink" href="http://maven.apache.org/plugins/maven-dependency-plugin/analyze-mojo.html"><tt>dependency:analyze</tt></a> goal but takes the NetBeans module system constraints into account (non-transitivity of module dependencies, public vs. private packages constraint etc)</li>
<li>The previous versions didn't define the <tt>OpenIDE-Module-Public-Packages</tt> entry in the manifest file. The result was a deprecated state that made all classes publicly accessible from other modules and printed a warning to the application's log file. In <b>3.0</b>, we introduced a new optional parameter <tt>publicPackages</tt> that lists all public packages in the module. If not defined, no package is exported as public. See <a class="externalLink" href="https://github.com/mojohaus/nbm-maven-plugin/issues/3">issue</a> for details. If you have previously placed the <b>OpenIDE-Module-Public-Packages</b> entry in the manifest file manually, it will not be overriden by the new parameter.<hr /></li></ul></div>
<div class="section">
<h2><a name="Upgrading_from_2.4_version_to_2.5">Upgrading from 2.4 version to 2.5</a></h2>
<p>There are significant changes in how NetBeans module system dependencies are mapped to maven's own dependencies model. The <b>2.4</b> and older version all module system deps had to be explicitly defined in the module descriptor at <tt>src/main/nbm/module.xml</tt>. That is no longer a requirement in <b>2.5</b> for most cases. The plugin will try to decide based on the declaration in maven POM file. </p>
<p>These are the rules:</p>
<ul>
<li>for NetBeans module dependencies (jars that have the NetBeans specific entries in META-INF/MANIFEST.MF)
<ul>
<li>It's defined in existing (though optional) <tt>module.xml</tt> file in <tt>dependencies</tt> section.</li>
<li>It's a direct dependency (non-transitive) and is a NetBeans module.</li>
<li>When the dependency is of type <tt>nbm</tt>. Such dependencies don't include their transitive deps on compilation classpath.</li></ul></li>
<li>for module libraries (jars that are packed together with the module and appear on it's classpath directly, not by a dependency relationship.)
<ul>
<li>It's defined in existing (though optional) <tt>module.xml</tt> file in <tt>libraries</tt> section</li>
<li>It's a direct dependency (non-transitive) and is not of <tt>provided</tt> scope.</li></ul></li></ul>
<p>So if you have used <b>2.4</b> and older before, you need to check your dependencies when upgrading to <b>2.5</b>.</p>
<ul>
<li>The <b>2.5</b> plugin can pick up and declare more module dependencies than the previous version. Module dependencies are safe. You either declared them in your <tt>module.xml</tt> file. Some additional ones can appear if you have them as direct dependencies in your pom. Use the <a class="externalLink" href="http://maven.apache.org/plugins/maven-dependency-plugin/analyze-mojo.html"><tt>dependency:analyze</tt></a> goal to check for used/unused direct dependencies.</li>
<li>The <b>2.5</b> plugin can also pick up and declare more module libraries. That's something to watch out for! That happens again only when you declared the jars as direct dependencies. You could end up with a single jar being added to multiple modules and get runtime classpath issues and of course your download size will get higher than necessary. Again the <a class="externalLink" href="http://maven.apache.org/plugins/maven-dependency-plugin/analyze-mojo.html"><tt>dependency:analyze</tt></a> goal shall help. If you know the jar is required but is provided by a module you depend on, use the <tt>provided</tt> scope to prevent inclusion.</li></ul></div>
</div>
</div>
</div>
<div class='grid-container incubator-area' style='margin-top: 64px'>
<div class='grid-x grid-padding-x'>
<div class='large-auto cell text-center'>
<a href="https://www.apache.org/">
<img style="width: 320px" title="Apache Software Foundation" src="/images/asf_logo_wide.svg" />
</a>
</div>
<div class='large-auto cell text-center'>
<a href="https://www.apache.org/events/current-event.html">
<img style="width:234px; height: 60px;" title="Apache Software Foundation current event" src="https://www.apache.org/events/current-event-234x60.png"/>
</a>
</div>
</div>
</div>
<div class='footer-disclaimer'>
<div class="footer-disclaimer-content">
<p>Copyright &copy; 2017-2018 <a href="https://www.apache.org">The Apache Software Foundation</a>.</p>
<p>Licensed under the Apache <a href="https://www.apache.org/licenses/">license</a>, version 2.0</p>
<p><a href="https://incubator.apache.org/" alt="Apache Incubator"><img src='/images/incubator_feather_egg_logo_bw_crop.png' title='Apache Incubator'></img></a></p>
<div style='max-width: 40em; margin: 0 auto'>
<p>Apache NetBeans is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.</p>
<p>Apache Incubator, Apache, the Apache feather logo, the Apache NetBeans logo, and the Apache Incubator project logo are trademarks of <a href="https://www.apache.org">The Apache Software Foundation</a>.</p>
<p>Oracle and Java are registered trademarks of Oracle and/or its affiliates.</p>
</div>
</div>
</div>
<a href="https://github.com/apache/incubator-netbeans-mavenutils"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png" alt="Fork me on GitHub"></a>
<script src="/js/vendor/jquery-3.2.1.min.js"></script>
<script src="/js/vendor/what-input.js"></script>
<script src="/js/vendor/jquery.colorbox-min.js"></script>
<script src="/js/vendor/foundation.min.js"></script>
<script src="/js/netbeans.js"></script>
<script>
$(function(){ $(document).foundation(); });
</script>
</body>