Build module with different versions of libs in Maven

那年仲夏 提交于 2019-12-11 20:26:37

问题


I have a Netbeans' module (Module.jar) with a lot of dependencies declared on its pom.xml:

<groupId>com.company</groupId>
<artifactId>module</artifactId>
<packaging>nbm</packaging>
...
<dependency>
    <groupId>org.netbeans.api</groupId>
    <artifactId>org-netbeans-modules-editor-lib</artifactId>
    <version>${netbeans.version}</version>
    <scope>runtime</scope>
</dependency>
<dependency>
    <groupId>org.netbeans.api</groupId>
    <artifactId>org-netbeans-modules-editor-lib2</artifactId>
    <version>${netbeans.version}</version>
</dependency>
...
<properties>
    <netbeans.version>RELEASE701</netbeans.version>
</properties>

As you can see, the version is declared as the variable netbeans.version.

Now I have two Netbeans Platform applications that use this module: ApplicationA uses NB Platform version 6.9.1 and ApplicationB uses NB Platform 7.0.1. Both will declare Module as a dependency:

<dependency>
    <groupId>com.company</groupId>
    <artifactId>module</artifactId>
    <version>3.0.10</version>
</dependency>

Module compiles fine with both versions of the platform, but will only run properly if it was compiled with the same version of the libs the current application uses (i.e., Module will only run properly on ApplicationA if compiled with version 6.9.1, and will only run properly on ApplicationB if compiled with version 7.0.1).

How/where can I define the variable netbeans.version, so Module will compile with the proper version of the libs according to the application that will use it?


回答1:


You should include netbeans dependencies directly in poms of ApplicationA and ApplicationB with correct versions. This way you will get exact version this application needs.



来源:https://stackoverflow.com/questions/9095593/build-module-with-different-versions-of-libs-in-maven

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!