ricardo
ricardo

Reputation: 621

The authorization of the Artifactory in Jenkins does not work

I´m using Artifactory 2.4.0 and Jenkins 1.438 and I have maven project with several modules. Need to deploy all modules(jars and one resulting war) into remote Artifactory server by Jenkins.

My user admin for artifactory was with default password (password) and all builds that I tried to execute on jenkins works fine. So when I resolved to change de Artifactory admin password and update my settings with the new credentials of admin, I had the following error on jenkins build log:

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project pilotoExemplo: Failed to deploy artifacts: 
Could not transfer artifact br.com.pilotoExemplo:pilotoExemplo:pom:2.1.0.11-20120705.160113-1 from/to snapshot 
({ip_server}/artifactory/libs-snapshot-local): Failed to transfer file: 
{ip_server}/artifactory/libs-snapshot-local/br/com/pilotoExemplo/pilotoExemplo/2.1.0.11-SNAPSHOT/pilotoExemplo-2.1.0.11-20120705.160113-1.pom. 
Return code is: 401 

Anyone already saw this problem before? I don´t found anything like this search on the google.

Here is my settings.xml:

  <mirrors>
    <mirror>
      <mirrorOf>*</mirrorOf>
      <name>repositorio</name>
      <url>{ip_server}/artifactory/repo</url>
      <id>repositorio</id>
    </mirror>
  </mirrors>
 
  <profiles>
    <profile>
      <repositories>
        <repository>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
          <id>central</id>
          <name>libs-release</name>
          <url>{ip_server}/artifactory/libs-release/</url>
        </repository>
        <repository>
          <snapshots />
          <id>snapshots</id>
          <name>libs-snapshot</name>
          <url>{ip_server}/artifactory/libs-snapshot/</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>plugins-release</name>
          <url>{ip_server}/artifactory/plugins-release</url>
        </pluginRepository>
      </pluginRepositories>
      <id>artifactory</id>
      <distributionManagement>
    <repository>
        <id>release</id>
        <url>{ip_server}/artifactory/libs-release-local/</url>
    </repository>
    <snapshotRepository>
        <id>snapshot</id>
        <url>{ip_server}/artifactory/libs-snapshot-local/</url>
    </snapshotRepository>
      </distributionManagement>
    </profile>
  </profiles>
 
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
 
  <servers>
    <server>
      <id>snapshot</id>
       <username>admin</username>
      <password>newPassword</password>
    </server>
 
    <server>
      <id>release</id>
      <username>admin</username>
      <password>newPassword</password>
    </server>
 
    <server>
      <id>repositorio</id>
       <username>admin</username>
      <password>newPassword</password>
    </server>
 
  </servers>

Upvotes: 1

Views: 4816

Answers (2)

Pmt
Pmt

Reputation: 1152

Tip to solve the problem with the clear text password:

  • Access and login into Artifactory.
  • Once you are logged in, click over your user name, on the superior right corner of the screen.
  • Put your password then clique in the em Unlockbutton, enabling the encrypted password.
  • Copy the tag that will be showed on the inferior part of the screen and paste it into the settings.xml file. If you prefer to just copy the password, be sure about let it exactly equals the tag showed below, including the "\" at the beginning of the password.
  • Remember to adjust the tag with the id of your server, defined into the tag, in your POM.xml
  • Click in Update button and ready! Check if everything will occur well at the next project's publication.

Upvotes: 1

G&#225;bor Lipt&#225;k
G&#225;bor Lipt&#225;k

Reputation: 9776

As far as I know Jenkins jobs can have their own M2 repository, or they use the repository of the user. So the answer could be, that your jenkins is running as a service (maybe as local system account), and not in the name of your user.

You can check the user name at the Jenkins setting/system information page (yourcontextroot/systemInfo). So basicly the solution is to put the same settings file for the running user, like you have.

Upvotes: 1

Related Questions