Erel Segal-Halevi
Erel Segal-Halevi

Reputation: 36793

Could not transfer artifact - not authorized

I want to use an artifact "eu.excitementproject:lap:jar:1.1.0:" from the following repository:

http://hlt-services4.fbk.eu:8080/artifactory/repo/eu/excitementproject

I can download the jar directly from the above link without any authorization.

However, when I mvn install on my computer, I get the following error:

Could not transfer artifact eu.excitementproject:lap:pom:1.1.0 from/to excitement 
(http://hlt-services4.fbk.eu:8080/artifactory/repo/eu/excitementproject): 
Not authorized

Here is the relevant part of my pom.xml:

  <repositories>
    <repository>
      <id>excitement</id>
      <name>excitement</name>
      <url>http://hlt-services4.fbk.eu:8080/artifactory/repo/eu/excitementproject</url>
    </repository>
  </repositories>

  <dependencies>
        <dependency>
            <groupId>eu.excitementproject</groupId>
            <artifactId>lap</artifactId>
            <version>1.1.0</version>
        </dependency>
  </dependencies>

What should I do?

Upvotes: 9

Views: 39471

Answers (2)

dmitry.bogatko
dmitry.bogatko

Reputation: 1219

you can provide credentials to your artifactory using basic url authentification(https://developer.mozilla.org/en-US/docs/Web/HTTP/Basic_access_authentication). In your case repository url should be: http://USERNAME:[email protected]:8080/artifactory/repo/eu/excitementproject

Upvotes: 4

manish
manish

Reputation: 20135

Your Maven configuration is:

  1. repository URL - http://hlt-services4.fbk.eu:8080/artifactory/repo/eu/excitementproject
  2. group-id - eu.excitementproject
  3. artifact-id - lap
  4. artifact-version - 1.1.1.

The full path to the artifact is therefore http://hlt-services4.fbk.eu:8080/artifactory/repo/eu/excitementproject/eu.excitementproject/lap/1.1.1/lap-1.1.1.pom.

If I hit this URL from any web browser, I am asked to authenticate using basic HTTP authentication. This is exactly what Maven also sees. Therefore, as @Will mentioned above, if you wish to continue using this repository URL, you will have to configure authentication settings for the repository in your local settings.xml.

Interestingly, I can hit http://hlt-services4.fbk.eu:8080/artifactory/repo/eu.excitementproject/lap/1.1.1/lap-1.1.1.pom without problems. So, if you shorten your repository URL to http://hlt-services4.fbk.eu:8080/artifactory/repo, your build will work (I have tested this).

Upvotes: 7

Related Questions