Vahid F
Vahid F

Reputation: 458

where is Jenkins default maven-repository?

I have Jenkins ver.2.121.1 installed on Windows Server 2012 R2 along with Apache Maven 3.5.2.
In localhost:8080/systeminfo link, $MAVEN_HOME environment variable is set correctly (to C:\\apache-maven-3.5.2\) and maven saves my custom libraries in ~\.m2\.repository\ but Jenkins saves the custom libraries(like ojdbc, ...) in another directory (in C:\\Program Files(x86)\Jenkins\maven-repositories\0\).

In jenkins config.xml (in C:\\Program Files(x86)\Jenkins\config.xml), no line is specified about maven local repositories (for example nothing is defined like <localRepository>${env.HOME}/.m2/repository</localRepository>).
Is there any clear reason why Jenkins uses its own maven repository directory? Should I addres my own maven directory to force jenkins give priority to it?

Upvotes: 0

Views: 4827

Answers (2)

Enrique Cuchetti
Enrique Cuchetti

Reputation: 91

If using a Jenkinsfile configuration you may add Jenkins default repository to get artifacts when installing/compiling with maven. Like this:

script {
      try {
        sh 'mvn -Dmaven.repo.local=/data/jenkins/repository/ clean install'
      } catch (errorDescription) {
       // do whatever you need to notify error
      }

Upvotes: 1

vikingsteve
vikingsteve

Reputation: 40388

Try http://localhost:8080/configure and you can see and specify "Local Maven Repository" there.

Maven Project Configuration

Upvotes: 1

Related Questions