我有一个像maven这样的多项目:
paren-project
-> plugin-project
-> testbed-project
Run Code Online (Sandbox Code Playgroud)
该plugin项目生成一个JAR,手动将其复制到特定的子目录testbed(使用groovy或ant等嵌入式脚本).重点:我不希望插件JAR位于testbed的类路径中.
但我找不到强制插件项目在测试平台项目之前构建的解决方案.如果我将插件项目设置为testbed项目的依赖项,则会将其添加到类路径中.
Cha*_*suk 19
正如http://maven.apache.org/guides/mini/guide-multiple-modules.html中提到的那样
反应器排序
Run Code Online (Sandbox Code Playgroud)Because modules within a multi-module build can depend on each other, it is important that The reactor sorts all the projects in a way that guarantees any project is built before it is required. The following relationships are honoured when sorting projects:
- 项目依赖于构建中的另一个模块
- 插件声明插件是构建中的另一个模块
- 插件依赖于构建中的另一个模块
- 在构建中的另一个模块上构建扩展声明
- 模块元素中声明的顺序(如果没有其他规则适用)
请注意,仅使用"实例化"引用 - dependencyManagement和pluginManagement元素不会导致更改reactor排序顺序
Maven是一个多功能系统.无需切换.
您可以像这样添加依赖项:
<dependency>
<groupId>group</groupId>
<artifactId>artifact</artifactId>
<optional>true</optional>
</dependency>
Run Code Online (Sandbox Code Playgroud)
这样,依赖项将不会包含在类路径中.
阅读有关可选依赖性的更多信息
| 归档时间: |
|
| 查看次数: |
12785 次 |
| 最近记录: |