views:

207

answers:

2

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.

A: 

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
Pascal Thivent
Thank you for this. I will see how it works but to address some of your questions. We use separate pom files for Hudson that are named differently. These files are pom files but not pom.xml. As for the username and password, deploying a snapshot works just fine so they should be correct.
Bobnix
@Bobnix: They are maybe correct but it looks like they're not used during deploy. Try to reproduce the problem on the command line (by replicating what Hudson is doing). PS: sounds like a complex setup...
Pascal Thivent
Ok, so I ran the help goals which, while very cool, did not reveal anything out of the ordinary. I also tried to run the same (well, similar) command as Hudson but 1) an cant run it on the server, no access and 2) cant run it locally since I am missing and unable to install svn. A great deity conspires against me.
Bobnix
@Bobnix: Sorry but since you're the only one who can potentially reproduce the problem, I won't be able to help more (at least not without exhaustive details). I still think that there is something weird happening when mixing all these poms/settings/profiles when Hudson is running though.
Pascal Thivent
Thanks anyway, I learned some new tricks. This is a fragile pile of systems anyway.
Bobnix
A: 

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.

Bobnix