12 maven-2 maven-assembly-plugin
我有一个只包含文件的项目.我想将这些文件打包成zip并将它们存储在maven存储库中.我有配置插件配置来构建zip文件,该部分工作正常,但我似乎无法弄清楚如何安装zip文件?
另外,如果我想在另一个工件中使用这个程序集,我该怎么做?我打算调用依赖:unpack,但我没有在存储库中有一个工件来解压缩.
如何将zip文件放在我的存储库中,以便我可以在另一个工件中重复使用它?
父母pom
<build>
<plugins>
<plugin>
<!--<groupId>org.apache.maven.plugins</groupId>-->
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<configuration>
<filters>
<filter></filter>
</filters>
<descriptors>
<descriptor>../packaging.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
儿童POM
<parent>
<groupId>com. ... .virtualHost</groupId>
<artifactId>pom</artifactId>
<version>0.0.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<name>Virtual Host - ***</name>
<groupId>com. ... .virtualHost</groupId>
<artifactId>***</artifactId>
<version>0.0.1</version>
<packaging>pom</packaging>
Run Code Online (Sandbox Code Playgroud)
我把名字过滤掉了.这个POM是否正确?我只想将特定虚拟主机的文件捆绑在一起.
谢谢,
沃尔特
Pas*_*ent 15
我有配置插件配置来构建zip文件,该部分工作正常,但我似乎无法弄清楚如何安装zip文件?
那么,创建装配应得到自动连接到该项目,然后上传到上的存储库install和deploy目标.你能展示你的pom吗?
更新:使用您当前的配置,我不认为程序集是作为构建的一部分创建的.您需要将single目标绑定到生命周期阶段,通常是package:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<configuration>
<descriptors>
<descriptor>../packaging.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- append to the packaging phase. -->
<goals>
<goal>single</goal> <!-- goals == mojos -->
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
现在它应该正确安装/部署.
另外,如果我想在另一个工件中使用这个程序集,我该怎么做?我打算调用依赖:unpack,但我没有在存储库中有一个工件来解压缩.
您可以声明对程序集的依赖关系(使用右侧classifier和type您的情况)但由于依赖关系是通过存储库解决的,因此您需要先解决第一步.然后,声明类似这样的东西(分类器是程序集的id):
<dependency>
<groupId>com. ... .virtualHost</groupId>
<artifactId>***</artifactId>
<version>0.0.1</version>
<classifier>...</classifier>
<type>zip</type>
</dependency>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16603 次 |
| 最近记录: |