Search code examples
gitmavennexus

Maven Release without pushing to Nexus (aka maven central)


I've got a java application that I want to follow the typical maven release cycle with, but I don't want or need to push the application to Nexus (or maven central).

When I run

mvn release:prepare release:perform -Darguments="-DskipTests=true -Dmaven.javadoc.skip=true"

I get an error during the perform stage that says the pom.xml file was missing the <distributionManagement> definitions required to push the built artifacts to NEXUS (our internal maven repo).

I'm using git and when I use git log I can see that all the other steps that I wanted to perform were performed properly.

  • The pom.xml file was changed from 1.2-SNAPSHOT to 1.2 and a commit was performed and a git tag was created at to tag that release.
  • The pom.xml file was then changed to 1.3-SNAPSHOT to ready the git branch to be used for subsequent development.

So... everything looks good. All I want to do is to tell maven not to try to do the push so the command completes without an error. NOTE: A couple files from release:prepare were left around, one was release.properties, but I can live with manually deleting that if necessary.

Some solutions I'm looking for are:

  • You can't do that.
  • Just take off the release:perform and only run release:prepare. I'm testing this now.
  • Add the flag -DmavenReleasePluginDontPushToNexus=true. I'm making this up but wondering if there is a flag.

I've looked for solutions to all the above and haven't found an answer yet.

Searching for solution

Maven Release Plugin

Stack Overflow Searches

My guess is that this has been asked and answered before but so far I can't find it.


Solution

  • I confirm, the release:prepare phase will:

    • Verify that there are no uncommitted changes in the workspace.
    • Prompt the user for the desired tag, release and development version names.
    • Modify and commit release information into the pom.xml file.
    • Tag the entire project source tree with the new tag name.

    The only missing step from release:perform that you might need is the increment of the version to the next SNAPSHOT, transforming the release version to a new snapshot, in order to prepare for the next batch of work.
    Using version:set will be required.