1

我有一个多模块 Maven 项目。

在最后执行的模块中,我使用Appassambler 插件组装 dist 目录。

然后我想将其压缩并部署为 Maven 工件。

我打算以某种方式简单地压缩它,然后使用deploy:deploy-file.

还有更多类似 Maven 的替代品吗?

我已经看到了Shade 插件和的组合deploy:deploy,但似乎很难说服Shade 压缩特定目录。

我对整个“组装、压缩和部署”过程的任何解决方案持开放态度。

4

1 回答 1

1

尽管我非常支持 Maven,但我不得不说,我发现的所有用于创建应用程序分发的 Maven 工具都不能令人满意。它们要么是错误的,要么是记录不充分的,要么是用户敌对的。

我采用了我阅读的概念,其中 appassemble 插件准备的目录使用 Ant 压缩(assembly-plugin 也失败了),然后添加为模块的工件之一。

这是我的解决方案,但是如果有人想证明我错了并使用标准 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>
于 2013-07-10T22:17:29.663 回答