Search code examples
javamavennetbeans-platformmaven-nbm

exporting all packages in nbm-maven-plugin


I'm creating a wrapper module in Netbeans platform that contains a set of jar dependencies, I want to make all of the packages (including ones in jars) available to other modules that depends on this wrapper. so far I've been able to do it by configuring nbm-maven-plugin in pom this way:

<build>
    ...
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>nbm-maven-plugin</artifactId>
        <configuration>
            <publicPackages>
                <package>org.w3c.dom.traversal</package>
                <package>org.w3c.dom.views</package>
                <package>org.w3c.dom.xpath</package>
                <package>org.xml.sax</package>
                <package>org.xml.sax.ext</package>
                ... etc
            </publicPackages>
        </configuration>
    </plugin>

The problem is that the wrapper got dozens of jars which each one have loads of packages to be exported. this makes pom file so long (so far more than 1K line of packages and I had to add them all manually to make the project build proceed)

Is there any way or configuration to make all packages public without listing them up all in pom?


Solution

  • I use this plugin: https://github.com/mojohaus/nbm-maven-plugin

    And there you can use wildcards to define the packages:

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>nbm-maven-plugin</artifactId>
        <version>3.8.1</version>
        <extensions>true</extensions>
        <configuration>
            <publicPackages>
                <publicPackage>org.foo.api</publicPackage>
                <publicPackage>org.apache.commons.*</publicPackage>
            </publicPackages>
        </configuration>
    </plugin>