Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-12977

Unable to build maven2 project with maven2/3 native jobs "Not authorized, ReasonPhrase:Unauthorized"

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • maven-plugin
    • jenkins-LTS-1.424.3 (issue was not there in LTS-1.424.2)

      Since the upgrade to Jenkins-1.424.3, we are unable to build a native maven build on maven2 projects.

      Seems like it's trying to parse the project's pom, and it won't succeed.
      Might be related to the bigger strictness of M3, but from a m2 project point of view, it's a regression :-/.

      L'ééchéance d'une alarme périodique a provoqué le lancement de ce job
      ln -s 2012-03-02_07-28-27 /ic/.jenkins/jobs/someproject-10.0/builds/517 failed: -1 
      Building on master
      Updating svn://somesvn/someproject-parent
      At revision 69492
      no change for svn://somesvn/someproject-parent since the previous build
      No emails were triggered.
      Parsing POMs
      Failed to transfer Not authorized, ReasonPhrase:Unauthorized.
      ERROR: Echec à la lecture des POMs
      org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
      [FATAL] Non-resolvable parent POM: Could not transfer artifact fr.gid:someartefact:pom:11.5.0 from/to devRepo (http://repository.corp.net:8081/nexus/content/groups/public/): Not authorized, ReasonPhrase:Unauthorized. and 'parent.relativePath' points at wrong local POM @ line 5, column 10
      
      	at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:339)
      	at hudson.maven.MavenEmbedder.buildProjects(MavenEmbedder.java:360)
      	at hudson.maven.MavenEmbedder.readProjects(MavenEmbedder.java:330)
      	at hudson.maven.MavenEmbedder.readProject(MavenEmbedder.java:321)
      	at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1355)
      	at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1182)
      	at hudson.FilePath.act(FilePath.java:758)
      	at hudson.FilePath.act(FilePath.java:740)
      	at hudson.maven.MavenModuleSetBuild$RunnerImpl.parsePoms(MavenModuleSetBuild.java:869)
      	at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:634)
      	at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:458)
      	at hudson.model.Run.run(Run.java:1376)
      	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:487)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:175)
      [WARNINGS] Skipping publisher since build result is FAILURE
      Saut de l&#39analyse sonar suite à un mauvais status de construction FAILURE
      Email was triggered for: Failure
      Sending email for trigger: Failure
      Sending email to: team@corp.fr
      Notifying upstream projects of job completion
      Finished: FAILURE
      

      I didn't put that issue as BLOCKER since the solution is to recreate the job as freestyle one. But it's an awkward solution.

      PS : yes, I know the feature is still said to be beta.

      Cheers

          [JENKINS-12977] Unable to build maven2 project with maven2/3 native jobs "Not authorized, ReasonPhrase:Unauthorized"

          Hi there,

          I was having the same issue here, using Jenkins ver. 1.447.1, running mvn clean test install site

          Interesting that dropping the site option it works. And if I executed the same command as normal user, including the site goal, it would run (jenkins had its own user).

          Then I noticed my user had ./m2/settings-security.xml and user/password configured in settings.xml.

          I copied the settings-security.xml to $jenkins_user_home_directory/.m2 and it's working again. In my case, I believe it was an issue with maven site and sonatype (the parent of my project was sonatype 5). http://jira.codehaus.org/browse/MSITE-81

          HTH

          Bruno P. Kinoshita added a comment - Hi there, I was having the same issue here, using Jenkins ver. 1.447.1, running mvn clean test install site Interesting that dropping the site option it works. And if I executed the same command as normal user, including the site goal, it would run (jenkins had its own user). Then I noticed my user had ./m2/settings-security.xml and user/password configured in settings.xml. I copied the settings-security.xml to $jenkins_user_home_directory/.m2 and it's working again. In my case, I believe it was an issue with maven site and sonatype (the parent of my project was sonatype 5). http://jira.codehaus.org/browse/MSITE-81 HTH

          evernat added a comment -

          Is this still an issue in Jenkins?

          evernat added a comment - Is this still an issue in Jenkins?

          Dave Taddei added a comment -

          I believe I have seen a similar issue in the most recent version of Jenkins (1.641) and this plugin (2.12.1)

          For me this occurs when using an artifact repository which requires server credentials.

          What works: Putting credentials in the settings.xml file directly. Obviously this means storing passwords in some form of plain text. Anyone could read them and gain read access to things they are not supposed to.

          I attempted to edit to settings.xml use an environment variable such as ${my.password} in place of credentials and was hoping to supply the password via the global passwords or mask passwords plugins.

          What doesn't work:
          1. Add environment variables via mask passwords plugin.
          2. Inject from global passwords
          3. Inject as environment variable did not work and exposed the value as plain text

          I suspect fixing compatibility with one of these plugins will solve this issue.

          Dave Taddei added a comment - I believe I have seen a similar issue in the most recent version of Jenkins (1.641) and this plugin (2.12.1) For me this occurs when using an artifact repository which requires server credentials. What works: Putting credentials in the settings.xml file directly. Obviously this means storing passwords in some form of plain text. Anyone could read them and gain read access to things they are not supposed to. I attempted to edit to settings.xml use an environment variable such as ${my.password} in place of credentials and was hoping to supply the password via the global passwords or mask passwords plugins. What doesn't work: 1. Add environment variables via mask passwords plugin. 2. Inject from global passwords 3. Inject as environment variable did not work and exposed the value as plain text I suspect fixing compatibility with one of these plugins will solve this issue.

          Dave Taddei added a comment -

          I do have a current work around. In the maven job add a pre-build step to invoke maven top level targets and call the clean goal. This does not require any repository interaction to perform and ensures that the environment variables containing passwords are present PRIOR to the main maven goal taking place.

          This allows the settings.xml to contain an environment variable for the password field.

          Dave Taddei added a comment - I do have a current work around. In the maven job add a pre-build step to invoke maven top level targets and call the clean goal. This does not require any repository interaction to perform and ensures that the environment variables containing passwords are present PRIOR to the main maven goal taking place. This allows the settings.xml to contain an environment variable for the password field.

          I don't know what to do with this issue, as I don't use the maven native jobs myself anymore (for many years now), and I recommend against using it...

          So still being the one who created it, but not interested in it anymore, so tempted to close it, but seems like some others want to follow up on it...

          Baptiste Mathus added a comment - I don't know what to do with this issue, as I don't use the maven native jobs myself anymore (for many years now), and I recommend against using it... So still being the one who created it, but not interested in it anymore, so tempted to close it, but seems like some others want to follow up on it...

            Unassigned Unassigned
            batmat Baptiste Mathus
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: