Password protected jenkins maven repository server - access from maven


I've got a password protected jenkins server with the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Maven+Repository+Server" rel="nofollow">Jenkins Maven Repository Server</a> plugin. My problem is, as it is password protected, i can't access the /plugin/repository/everything/ repo from within maven (Could not transfer metadata <metadata> from/to <repo-name> (http://ci.mydomain.com/plugin/repository/everything/): Access denied to: <repo>/<identifier> , ReasonPhrase:Forbidden.)

What i tried:<br /> - <a href="https://stackoverflow.com/a/27025081" rel="nofollow">Putting the server credentials in the .m2/settings.xml</a><br /> - Basic auth: http://<user>:<password>@ci.mydomain.com/<repo><br /> - without any auth

none worked...

any help would be appreciated.


My settings.xml:

<settings> <servers> <server> <id>test-ci</id> <username>jenkins</username> <password>password</password> </server> </servers> </settings>

and my pom.xml

<?xml version="1.0" encoding="UTF-8"?> <project> <groupId>com.mygroup</groupId> <artifactId>Artifact</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <repositories> <repository> <id>test-ci</id> <url>http://ci.mydomain.com/plugin/repository/everything/</url> </repository> </repositories> <dependencies> <dependency> <groupId>com.mygroup</groupId> <artifactId>ProjectOnCi</artifactId> <version>1.0-SNAPSHOT</version> <scope>provided</scope> </dependency> </dependencies> </project>


Just struggled a few hours with this problem today and finally found an answer.

First of all, to use HTTP basic authentication, you need to supply user and <strong>API Token</strong> as password. You can find this token at "Manage Jenkins" -> "Manage Users" -> "Edit User" (Settings icon next to user) -> "Show API Token".

Secondly, Jenkins is using <strong>preemptive authentication</strong>, which means that there is no HTTP authentication negotiation but you need to immediately send the credentials in the first request. You can read about it here: <a href="https://wiki.jenkins.io/display/JENKINS/Authenticating+scripted+clients" rel="nofollow">https://wiki.jenkins.io/display/JENKINS/Authenticating+scripted+clients</a>

To configure your Maven repository accordingly, make sure to use the following server configuration:

<server> <id>test-ci</id> <username>YOUR_USER</username> <password>YOUR_API_TOKEN</password> <configuration> <httpConfiguration> <all> <usePreemptive>true</usePreemptive> </all> </httpConfiguration> </configuration> </server>

This should work. I hope I could help you :)


You should note that <a href="https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Maven+Repository+Server" rel="nofollow">Jenkins Maven Repository Server</a> will not perform as Maven Repository, so if this is what you need (a Maven repo) - this Jenkins plugin will not help.

I suggest reading about <a href="https://maven.apache.org/guides/introduction/introduction-to-repositories.html" rel="nofollow">Maven Repos</a>; from what you write I think that an internal repository (e.g. <a href="http://www.sonatype.org/nexus/" rel="nofollow">Nexus</a>, <a href="https://www.jfrog.com/artifactory/" rel="nofollow">Artifactory</a>) might be good. Maven by default downloads JARs from Maven Central, so you do not (and should not) have to download all sources and build them.


  • SQL Azure SPLIT AT Backend Process and Resource Throttling
  • Grails 3 - How to publish to Artifactory
  • How to authenticate user name and password against Active Directory Federation Services (ADFS)?
  • limited threads in soapUI free version
  • Django: DRY principle and UserPassesTestMixin
  • Send emails through VB6 if no email client
  • Why isn't my “Fizz Buzz” test in R working?
  • Python PIL to extract number from image
  • Django return user model id with L
  • “mvn clean generate-source” could not resolve dependencies
  • Splash Screen will not display
  • CodeIgniter URI Parameter is partially bypassing an “if” statement
  • Xamarin Android | Layout style
  • Rest Services conventions
  • opencv display image without x server
  • Laravel: Getting Session ID oddly truncates when using foreach
  • How to get current document uri in XSLT?
  • Bad request using file_get_contents for PUT request in PHP
  • Jetty Server not starting: Unable to establish loopback connection
  • The plugin 'org.apache.maven.plugins:maven-jboss-as-plugin' does not exist or no valid ver
  • When to use `image` and when to use `Matrix` in Emgu CV?
  • Display issues when we change from one jquery mobile page to another in firefox
  • Deselecting radio buttons while keeping the View Model in synch
  • Encrypt data by using a public key in c# and decrypt data by using a private key in php
  • Uncaught Error: Could not find module `ember-load-initializers`
  • How to redirect a user to a different server and include HTTP basic authentication credentials?
  • SSO with signing and signature validation doesn't work
  • Deserializing XML into class C#
  • JSON with duplicate key names losing information when parsed
  • Jquery - Jquery Wysiwyg return html as a string
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • How to delete a row from a dynamic generate table using jquery?
  • How to include full .NET prerequisite for Wix Burn installer
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Codeigniter doesn't let me update entry, because some fields must be unique
  • Getting error when using KSoap library to consume .NET web services
  • How to stop GridView from loading again when I press back button?
  • costura.fody for a dll that references another dll
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize