我有一个多模块Maven项目。
在最后执行的模块中,我使用Appassambler plugin组装dist目录。
然后我想将其压缩并部署为maven工件。
我只是简单地以某种方式压缩它,然后使用deploy:deploy-file
。
还有更像maven的替代方案吗?
我已经看到了Shade plugin和deploy:deploy
的组合,但似乎很难说服压缩特定目录。
我对整个“组装,压缩和部署”流程的任何解决方案持开放态度。
答案 0 :(得分:1)
虽然我非常赞成Maven,但我不得不说,我发现用于创建应用程序发行版的所有Maven工具都不令人满意。要么他们有错误,要么记录不良,或者用户充满敌意。
我已经使用了我读过的概念,其中appassemble插件编写的目录使用Ant压缩(程序集插件也在此处失败),然后添加为模块的人工制品之一。
这是我的解决方案,但如果有人想证明我的错误并使用标准的Maven插件提供解决方案,我会保持打开的问题,谢谢。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution> <id>createDistJar</id>
<goals> <goal>run</goal> </goals> <phase>package</phase>
<configuration>
<target>
<echo message="${project.build.directory}"/>
<mkdir dir="${project.build.directory}"/>
<zip destfile="${project.build.directory}/JawaBot-${project.version}-dist.zip"
basedir="target/" includes="JawaBot-${project.version}-dist-rh/**">
</zip>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>uploadDistJar</id> <goals> <goal>attach-artifact</goal> </goals>
<phase>package</phase>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/JawaBot-${project.version}-dist.zip</file>
<type>zip</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>