Requirement: Upload (deploy) an additional file (a text format release note file) along with jar/war to nexus.
Possible Solution: Use maven deploy plugin as below:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<executions>
<execution>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<packaging>RELEASENOTE.MD</packaging>
<generatePom>false</generatePom>
<url>${project.distributionManagement.repository.url}</url>
<artifactId>${project.artifactId}</artifactId>
<groupId>${project.groupId}</groupId>
<version>${project.version}</version>
<file>RELEASENOTE.MD</file>
</configuration>
</execution>
</executions>
</plugin>
Problems:
- RELEASENOTE.MD file is optional. The file should be deployed only if it is present. The above solution throws an error if the file is not present.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.4:deploy-file (default) on project ...\RELEASENOTE.MD not found.
- Need an option to specify file name by regex (example: *RELEASENOTE.MD). maven deploy plugin does not accept regex.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.4:deploy-file (default) on project ...*RELEASENOTE.MD not found.
How can these two problems be circumvented?