に、あなたはが必要です。をビルドに添付すると、Mavenはそれをその結果の公式成果物として扱います。
ファイルをビルドに添付するには、build-helper-maven-plugin
を使用できます。ここで
はそのusageページからサンプルスニペットです:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.12</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>the-generated-file</file>
<type>extension of your file</type>
<classifier>optional</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
ときあなたは、ファイルの世代に責任があるプラグインの宣言の後に上記の構成を置くべきであるということです、ファイルが存在しなければなりませんそれをビルドにアタッチしてみてください。 file
構成要素を見てください。ここでファイルを指定する必要があります。 target\myfile.zip
。この場合、package
フェーズの間に接続され、install
フェーズとdeploy
フェーズが処理中に考慮されるようになります。
mvn clean install
を呼び出すときに、その後、ビルド出力の一部として見るでしょう:
[INFO] --- build-helper-maven-plugin:1.12:attach-artifact (attach-artifacts) @ zip-example ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ zip-example ---
[INFO] Installing C:\data\eclipse-workspace\zip-example\target\zip-example-0.0.1-SNAPSHOT.jar to c:\data\m2\repository\com\sample\zip-example\0.0.1-SNAPSHOT\zip-example-0.0.1-SNAPSHOT.jar
[INFO] Installing C:\data\eclipse-workspace\zip-example\pom.xml to c:\data\m2\repository\com\sample\zip-example\0.0.1-SNAPSHOT\zip-example-0.0.1-SNAPSHOT.pom
[INFO] Installing C:\data\eclipse-workspace\zip-example\sample.zip to c:\data\m2\repository\com\sample\zip-example\0.0.1-SNAPSHOT\zip-example-0.0.1-SNAPSHOT-optional.zip
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
注:sample.zip
が実際にzip-example-0.0.1-SNAPSHOT-optional.zip
としてm2
ローカルリポジトリにコピーされた、それゆえに応じて名前を変更しますプロジェクト構成(artifactId
,version
,classifier
)。
'.zip'ファイルは' target'フォルダの内容の一部ですが、ローカルの 'm2'キャッシュにコピーされていますか?私は仮定しません。 '.jar'だけが' deploy'の動作と一貫して存在するはずです。関連する 'pom.xml'ファイルをもっと共有できますか?ほとんどの場合、 'zip'ファイルはビルドに付加されていないアーチファクトとして生成されます。 –
@ A_Di-Matteoはい、そうです。ローカル 'm2キャッシュ 'の' .jar'のみです。 私は特別なプラグイン 'custom-plugin-packaging-zip'を持っています このプラグインは' target'フォルダに 'zip'ファイルを作成します。 これを追加してアーティファクトとして追加する方法はありますか? –