使用maven 3.0.4
我有一个多模块maven项目,一些模块生成war文件,一些生成jar文件,如各自的poms中声明的那样
我想创建一个分发档案,其中jar工件和依赖项进入一个子目录,而webapp工件(无依赖关系)进入另一个子目录。
类似
project.tar/lib <-- module jars and deps here
project.tar/webapp <-- wars here
让程序集将所有内容转储到一个目录中非常简单。
这就是我的尝试:
<assembly>
<id>bin</id>
<formats>
<format>tar.gz</format>
</formats>
<moduleSets>
<moduleSet>
<includes>
<include>${module.groupId}:${module.artifactId}:war:${module.version}</include>
</includes>
<binaries>
<includeDependencies>false</includeDependencies>
<outputDirectory>webapp</outputDirectory>
</binaries>
</moduleSet>
<moduleSet>
<includes>
<include>${module.groupId}:${module.artifactId}:jar:${module.version}</include>
</includes>
<binaries>
<includeDependencies>true</includeDependencies>
<outputDirectory>lib</outputDirectory>
</binaries>
</moduleSet>
</moduleSets>
</assembly>
现在当我运行这个时,我收到了这些警告:
[INFO] Reading assembly descriptor: assembly.xml
[WARNING] The following patterns were never triggered in this artifact inclusion filter:
o '${module.groupId}:${module.artifactId}:war:${module.version}'
[WARNING] The following patterns were never triggered in this artifact inclusion filter:
o '${module.groupId}:${module.artifactId}:jar:${module.version}'
[WARNING] The following patterns were never triggered in this artifact inclusion filter:
o '${module.groupId}:${module.artifactId}:war:${module.version}'
[WARNING] NOTE: Currently, inclusion of module dependencies may produce unpredictable results if a version conflict occurs.
[WARNING] The following patterns were never triggered in this artifact inclusion filter:
o '${module.groupId}:${module.artifactId}:jar:${module.version}'
不确定我做错了什么。我的包含遵循maven网页上指定的“group:artifact:version”模式。
由于
答案 0 :(得分:2)
这似乎有效。不过,不确定这是不是最好的方法。 Maven似乎没有兑现$ {module.whatever}变量。
<dependencySets>
<dependencySet>
<includes>
<include>${project.groupId}:*:war:${project.version}</include>
</includes>
<useProjectArtifact>true</useProjectArtifact>
<outputDirectory>webapp</outputDirectory>
<unpack>false</unpack>
</dependencySet>
<dependencySet>
<excludes>
<exclude>${project.groupId}:*:war:${project.version}</exclude>
</excludes>
<useProjectArtifact>true</useProjectArtifact>
<outputDirectory>lib</outputDirectory>
<unpack>false</unpack>
</dependencySet>
</dependencySets>