You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by sk...@apache.org on 2022/05/31 10:55:30 UTC

[netbeans-mavenutils-nbm-maven-plugin] branch master updated: [NETBEANSINFRA-264] Include runtime module libraries

This is an automated email from the ASF dual-hosted git repository.

skygo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans-mavenutils-nbm-maven-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 02f4344  [NETBEANSINFRA-264] Include runtime module libraries
     new bdb4830  Merge pull request #28 from ahauschulte/NETBEANSINFRA-264_add-dependencies-with-scope-runtime
02f4344 is described below

commit 02f4344c964853da91100e3495091b5480709cd2
Author: Axel Hauschulte <ax...@gmail.com>
AuthorDate: Sun Mar 27 13:23:18 2022 +0200

    [NETBEANSINFRA-264] Include runtime module libraries
    
    The nbm Maven plugin packs module libraries together with the module
    and adds them to the "Class-Path" entry of the manifest. These
    libraries are stored at netbeans\modules\ext within the module's
    nbm file. However, only libraries with scope "compile" are recognized.
    If the module declares dependencies (direct or transitive) with scope
    "runtime" in its pom file, these libraries won't be included in the
    module's nbm file nor will they be added to the classpath.
    
    Add the parameter includeRuntimeModuleLibraries to
    NetBeansManifestUpdateMojo to choose between the existing behaviour,
    i.e. adding module libraries with scope "compile" only. Or changing
    the creation of the dependency tree so that module libraries with
    scope "compile" as well as "runtime" will be recognized.
---
 .../org/apache/netbeans/nbm/NetBeansManifestUpdateMojo.java   | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/netbeans/nbm/NetBeansManifestUpdateMojo.java b/src/main/java/org/apache/netbeans/nbm/NetBeansManifestUpdateMojo.java
index b826a7b..5e30978 100644
--- a/src/main/java/org/apache/netbeans/nbm/NetBeansManifestUpdateMojo.java
+++ b/src/main/java/org/apache/netbeans/nbm/NetBeansManifestUpdateMojo.java
@@ -145,6 +145,14 @@ public class NetBeansManifestUpdateMojo
                 defaultValue = "${project.build.outputDirectory}/META-INF/MANIFEST.MF" )
     private File targetManifestFile;
 
+    /**
+     * Default behaviour is to add module libraries of scope <code>compile</code> to the classpath and bundle them with
+     * the nbm file. If set to true, module libraries of scope <code>runtime</code> will also be added to the classpath
+     * and bundled with the nbm file.
+     */
+    @Parameter( property = "maven.nbm.includeRuntimeModuleLibraries", defaultValue = "false" )
+    private boolean includeRuntimeModuleLibraries;
+
     /**
      * Verify the runtime NetBeans module dependencies and Class-Path items generated from Maven dependencies. The check
      * is done by matching classes used in current project. Allowed values for the parameter are <code>fail</code>,
@@ -465,7 +473,8 @@ public class NetBeansManifestUpdateMojo
         }
         getLog().debug( "module =" + module );
 
-        DependencyNode treeroot = createDependencyTree( project, dependencyGraphBuilder, "compile" );
+        final String scope = includeRuntimeModuleLibraries ? Artifact.SCOPE_COMPILE_PLUS_RUNTIME : Artifact.SCOPE_COMPILE;
+        DependencyNode treeroot = createDependencyTree( project, dependencyGraphBuilder, scope );
         Map<Artifact, ExamineManifest> examinerCache = new HashMap<Artifact, ExamineManifest>();
         @SuppressWarnings( "unchecked" )
         List<Artifact> libArtifacts = getLibraryArtifacts( treeroot, module, project.getRuntimeArtifacts(),


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists