Reputation: 83
I have a maven module for holding a plain text file that I need to "build" (rename the file with name-version-classifier.extension format) and deploy on my maven repository. I know I can deploy it via command line but I want to know if i can write a pom.xml whereby I can achive the same result.
LDM.
Upvotes: 6
Views: 4231
Reputation: 31087
From the discussion How to attach a text file to a module's distribution? :
In the past i've made use of the Build Helper plug-in to attach additional artifacts https://www.mojohaus.org/build-helper-maven-plugin
The example of how to attach additional artifacts to your project shows how to attach a file; make your module of type pom
and the additional artifact will be the only artifact deployed:
<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>
Upvotes: 9
Reputation: 266
Use build-helper-maven-plugin:attach-artifact
<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>
Upvotes: 1