Question

When using the release plug-in for Maven on Hudson(1.368), I am getting an error that my distributionManagement section is missing during the deployment phase to our Nexus Maven Repository Manager. If I deploy without using release It woks just fine so should not be a misconfiguration with the server, the section or the settings.

It is worth noting that my company uses different pom files for Hudson and have named them differently. Also the settings.xml in in the individual project directories. This has never been a problem as Hudson allows for the name of the pom and the location and name of the settings file to be specified.

The reason I note the above is that when distributionManagement is moved into the regular pom.xml it does find it (but still doesn't work because its missing the username and password in the settings file). This confuses the heck out of me since for the prior parts of the release process, it uses the correct pom and settings. It just seems to forget them later on. What is going on here?

Thank you in advance.

UPDATE
It seems that the maven release plug-in spins up a new instance of maven which, it seems, is using the default pom.xml rather than our differently named pom. More testing is needed.

Was it helpful?

Solution

The answer (for any lost souls who stumble upon this question) is that maven was indeed forking out a new process which was not using the correct pom file and settings. The solution was to add a section to the pom file as thus:

<plugin>
    <artifactId>maven-release-plugin</artifactId>
    <version>2.0</version>
    <configuration>
        <goals>-f POMFILE -s SETTINGSFILE deploy</goals>
    </configuration>
</plugin>

This specified those two files to the new maven process.

OTHER TIPS

If I deploy without using release It woks just fine so should not be a misconfiguration with the server, the section or the settings.

Well, there is clearly a misconfiguration somewhere, be it at the Hudson level. But it will be hard to spot it without seeing the pom, the settings, the active profiles, the profiles used during the release, the Hudson setup, etc.

First step: try to reproduce the problem on the command line using the exact same configuration as Hudson.

Second step: use the Maven Help Plugin to understand and debug the issue. More specifically, the following goals:

The reason I note the above is that when distributionManagement is moved into the regular pom.xml it does find it (but still doesn't work because its missing the username and password in the settings file).

It's unclear where the distributionManagement is specified if outside the project's pom.xml (in a corporate environment, it goes typically in a corporate pom.xml, is it the case here?).

It's also unclear if you are actually providing the username and password for a server id matching the repository id of the distributionManagement.

But somehow, a wrong combination is used here. Double check what profiles/settings are active during release/deploy to spot the problem as suggested.

See also

  • The Maven Deploy Plugin Usage page
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top