簡體   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