此任务会将工件附加到当前的 Maven 项目。这可用于安装和部署由 Ant 任务生成的工件。
这个例子展示了如何使用attachartifact任务。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>attach-artifact</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<zip destfile="my-project-src.zip"
basedir="."
includes="*.*"
/>
<attachartifact file="my-project-src.zip" classifier="src" type="zip"/>
</target>
</configuration>
</execution>
</executions>
</plugin>