在 Maven 发布期间部署 xml 个文件
Deploy xml files during maven release
在maven发布过程中,maven会尽量帮你上传源码、javadoc、jar到nexus或artifactory,除了那些,我还想上传一些东西,比如xml个文件。
有人知道怎么配置吗? Maven deploy plugin 貌似很简单,没有给用户提供这样的配置。
我应该改为使用部署文件目标吗?或者其他方式?
欢迎大家提出意见。
Br,
蒂姆
最简单的解决方案是像这样使用 build-helper-maven-plugin:
<project>
...
<build>
<plugins>
<plugin>
<!-- add configuration for antrun or another plugin here -->
</plugin>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>some file</file>
<type>extension of your file </type>
<classifier>optional</classifier>
</artifact>
...
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
您也可以单独创建一个资源包,通过maven-remote-resources-plugin在其他项目中使用。
在maven发布过程中,maven会尽量帮你上传源码、javadoc、jar到nexus或artifactory,除了那些,我还想上传一些东西,比如xml个文件。
有人知道怎么配置吗? Maven deploy plugin 貌似很简单,没有给用户提供这样的配置。
我应该改为使用部署文件目标吗?或者其他方式?
欢迎大家提出意见。
Br, 蒂姆
最简单的解决方案是像这样使用 build-helper-maven-plugin:
<project>
...
<build>
<plugins>
<plugin>
<!-- add configuration for antrun or another plugin here -->
</plugin>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>some file</file>
<type>extension of your file </type>
<classifier>optional</classifier>
</artifact>
...
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
您也可以单独创建一个资源包,通过maven-remote-resources-plugin在其他项目中使用。