ric*_*ich 5 java deployment maven
我希望与我的 jars、wars 等一起部署 XML 文件。我可以使用分类器手动执行此操作:
mvn deploy:deploy-file -DgroupId=${GROUP_ID} \
-DartifactId=$ARTIFACT_ID \
-Dversion=$VERSION \
-Dpackaging=xml \
-Dclassifier=metadata \
-Dfile=metadata.xml \
-DrepositoryId=releases \
-Durl=http://localhost/nexus/content/repositories/releases \
-DgeneratePom=false
Run Code Online (Sandbox Code Playgroud)
我希望从 pom.xml 中的属性填充 xml 文件,并通过一个简单的命令将其与主要工件一起部署,该命令适用于我们所有的内部项目。
是否可以配置部署插件来执行此操作(以及如何执行)?或者我需要走其他路线(也许是自定义 Maven 插件)?
达到这种目的的最佳解决方案就是简单地使用build-helper-maven-plugin,如下所示:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>x1.xml</file>
<type>xml</type>
<classifier>optional</classifier>
</artifact>
...
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
通过这种类型的设置,您可以使用通常的设置mvn deploy,这也将部署额外的工件,您可以将其附加到常用的构建工件。
| 归档时间: |
|
| 查看次数: |
4118 次 |
| 最近记录: |