Maven程序集插件-安装创建的程序集 [英] Maven Assembly Plugin - install the created assembly

查看:79
本文介绍了Maven程序集插件-安装创建的程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个仅由文件组成的项目.我想将这些文件打包为zip并将其存储在maven存储库中.我已将程序集插件配置为生成zip文件,并且该部分工作正常,但我似乎无法弄清楚如何安装zip文件?

I have a project that simply consists of files. I want to package those files into a zip and store them in a maven repository. I have the assembly plugin configured to build the zip file and that part works just fine, but I cannot seem to figure out how to install the zip file?

此外,如果我想在另一个工件中使用此程序集,我该怎么做?我打算打电话给dependency:unpack,但是我没有在仓库中解压的工件.

Also, if I want to use this assembly in another artifact, how would I do that? I am intending on calling dependency:unpack, but I don't have an artifact in the repository to unpack.

如何获取一个zip文件放在我的存储库中,以便可以在另一个工件中重复使用它?

How can I get a zip file to be in my repository so that I may re-use it in another artifact?

父母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>

儿童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>

我把名字过滤掉了.这个POM正确吗?我只想将特定虚拟主机的文件捆绑在一起.

I filtered the name out. Is this POM correct? I just want to bundle files for a particular virtual host together.

谢谢

沃尔特

推荐答案

我已将程序集插件配置为生成zip文件,并且该部分工作正常,但我似乎无法弄清楚如何安装zip文件?

I have the assembly plugin configured to build the zip file and that part works just fine, but I cannot seem to figure out how to install the zip file?

好吧,创建的程序集应该自动附加到项目中,然后根据installdeploy目标上传到存储库中.可以显示pom吗?

Well, the created assembly should get automatically attached to the project and then uploaded into the repository on an install and deploy goal. Can you show your pom?

更新:使用您当前的配置,我认为程序集不会作为构建的一部分而创建.您需要将single目标绑定到生命周期阶段,通常是package:

Update: With your current configuration, I don't think that the assembly gets created as part of your build. You need to bind the single goal to a lifecycle phase, typically 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>

现在应该可以正确安装/部署它了.

And now it should get installed/deployed properly.

此外,如果我想在另一个工件中使用此程序集,我该怎么做?我打算打电话给dependency:unpack,但是我没有在仓库中解压的工件.

Also, if I want to use this assembly in another artifact, how would I do that? I am intending on calling dependency:unpack, but I don't have an artifact in the repository to unpack.

您可以声明对程序集的依赖关系(在您的情况下使用正确的classifiertype),但是由于依赖关系是通过存储库解决的,因此您需要首先解决第一步.然后,声明这样的内容(其中分类符是程序集的ID):

You can declare a dependency on an assembly (using the right classifier and type in your case) but since dependency are resolved through the repository, you'll need to solve the first step first. Then, declare something like this (where the classifier is the assembly's id):

<dependency>
  <groupId>com. ... .virtualHost</groupId>
  <artifactId>***</artifactId>
  <version>0.0.1</version>
  <classifier>...</classifier>
  <type>zip</type>
</dependency>

这篇关于Maven程序集插件-安装创建的程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆