Maven deploy “Release Note” as artifact

0 votes

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:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.4:deploy-file (default) on project ...\RELEASENOTE.MD not found.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.4:deploy-file (default) on project ...*RELEASENOTE.MD not found.

How do I solve these two problems?

Jun 19, 2018 in DevOps Tools by shubham
• 6,890 points
165 views

1 answer to this question.

0 votes

Using both @SpaceTrucker and @khmarbaise, came up with the following solution:

<profiles>
    <profile>
        <id>add-release-note</id>
        <activation>
            <file><exists>RELEASENOTE.MD</exists></file>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>3.0.0</version>
                    <executions>
                        <execution>
                            <id>attach-artifacts</id>
                            <phase>package</phase>
                            <goals>
                                <goal>attach-artifact</goal>
                            </goals>
                            <configuration>
                                <artifacts>
                                    <artifact>
                                        <file>RELEASENOTE.MD</file>
                                        <type>MD</type>
                                        <classifier>RELEASENOTE</classifier>
                                    </artifact>
                                </artifacts>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

Edit

  • maven-deploy-plugin within profile activation works too. However, it poses a difficulty for release/snapshot build parameterization due to its <url> tag. build-helper-maven-plugin is a simpler solution

  • Filename regex can be handled through a wrapper shell build script

I hope that above information would be helpful to you.
answered Jun 19, 2018 by Atul
• 10,240 points

Related Questions In DevOps Tools

+4 votes
2 answers

Jenkins not showing Maven Release Plugin

Make your project type Maven Project. This ...READ MORE

answered Oct 11, 2018 in DevOps Tools by Hannah
• 16,220 points
827 views
0 votes
1 answer

running comands as non-root user while using docker-maven plugin

Docker needs root access therefore maven commands ...READ MORE

answered Apr 30, 2018 in DevOps Tools by ajs3033
• 7,280 points
586 views
0 votes
1 answer

How to deploy kafka cluster on cloud?

You can run kafka in both ways ...READ MORE

answered Jun 14, 2018 in DevOps Tools by DareDev
• 6,810 points
59 views
0 votes
1 answer

How to download the latest minor version of nexus artifact using REST?

If you're using nexus 2.x, you can ...READ MORE

answered Jun 27, 2018 in DevOps Tools by ajs3033
• 7,280 points
484 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
208 views
0 votes
1 answer
0 votes
1 answer

Maven deploy Release Note as artifact

The following solution will do the trick: <profiles> ...READ MORE

answered Jun 22, 2018 in DevOps Tools by Atul
• 10,240 points
51 views
0 votes
1 answer

How to deploy Liberty packaged server automatic delivery

Here is a concept regarding your query. It ...READ MORE

answered Jul 11, 2018 in DevOps Tools by Atul
• 10,240 points
46 views