繁体   English   中英

如何在要安装/部署的Maven中指定工件名称

[英]How to specify artifact name in maven that I want installed/deployed

我有一个Maven Pom Orchestrator文件,用于控制所有模块的构建。 作为我的协调器步骤的最终构建,我通过exec-maven-plugin调用Shell脚本来手动创建一个zip文件。

我想将我创建的这个zip文件放在我的m2文件夹中,并部署到我的nexus存储库中。

是否有简单的指示即可指示Maven部署/安装此zip文件? 现在,我文件的包装类型是pom,但是我可以将其更改为其他类型。

目前,不能将构建更改为使用插件而不是Shell脚本。

<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.proj</groupId>
    <artifactId>proj</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>Proj</name>

    <modules>
        <module>ProjCommon</module>
        <module>ProjEar</module>
    </modules>

    <build>
        <plugins>
            <plugin>
                <artifactId>exec-maven-plugin</artifactId>
                <groupId>org.codehaus.mojo</groupId>
                <executions>
                    <execution>
                        <id>Zip packaging and deployment</id>
                        <phase>package</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>${bash.path}</executable>
                            <arguments>
                                <argument>${bash.arguments}</argument>
                                <argument>${basedir}/../deployer/post-build-sbic.sh</argument>
                            </arguments>
                            <environmentVariables>
                                <MAJOR_VERSION>${major.version}</MAJOR_VERSION>
                                <MINOR_VERSION>${minor.version}</MINOR_VERSION>
                                <ARTIFACTS_DIR>${artifacts.folder}</ARTIFACTS_DIR>
                            </environmentVariables>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project> 

尝试这样的事情:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>build-helper-maven-plugin</artifactId>
  <executions>
      <execution>
          <id>attach-artifacts</id>
          <phase>package</phase>
          <goals>
              <goal>attach-artifact</goal>
          </goals>
          <configuration>
              <artifacts>
                  <artifact>
                      <file>target/my-custom-archive.zip</file>
                      <type>zip</type>
                      <classifier>dist</classifier>
                  </artifact>
              </artifacts>
          </configuration>
      </execution>
  </executions>
</plugin>

尝试对您的项目执行{mvn deploy}。 如果一切成功,这应该构建您的项目并将工件部署到您的仓库和联系。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM