我有一个maven模块来保存我需要“构建”的纯文本文件(使用name-version-classifier.extension格式重命名文件)并部署在我的Maven仓库。 我知道我可以通过命令行部署它,但我想知道我是否可以编写一个pom.xml,从而可以实现相同的结果。如何“构建”和部署一个纯文本的maven神器
LDM。
我有一个maven模块来保存我需要“构建”的纯文本文件(使用name-version-classifier.extension格式重命名文件)并部署在我的Maven仓库。 我知道我可以通过命令行部署它,但我想知道我是否可以编写一个pom.xml,从而可以实现相同的结果。如何“构建”和部署一个纯文本的maven神器
LDM。
从讨论 How to attach a text file to a module's distribution?:
在过去,我利用了建立帮助插件附加其他文物 http://mojo.codehaus.org/build-helper-maven-plugin
如何attach additional artifacts to your project展示了如何的例子附加文件;使pom
类型的模块和附加神器将要部署的唯一神器:
<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>some file</file>
<type>extension of your file </type>
<classifier>optional</classifier>
</artifact>
...
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
使用构建辅助性Maven的插件:附加神器
<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.8</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>
的GAV中,maven生成两个工件:一个jar和(期望)palaintext工件,可能只有一个(第二个)工件? –
' POM '的确很重要以这种方式添加到'pom.xml' –