0

I have added following repository to my maven configuration.

<repositories>
    <repository>
        <id>android</id>
        <url>file://${env.ANDROID_HOME}/extras/android/m2repository</url>
    </repository>
</repositories>

After that I have noticed that during build on Jenkins artifacts are installed in that repository instead in ~/.m2/repository. I can't reproduce the same behavior on my local machine.

How can I mark that repository as read only so that artifacts are installed in ~/.m2/repository?

delor
  • 800
  • 1
  • 7
  • 19
  • Don't define this kind of repositories in your pom. Better start using a repository manager and store the artifacts there instead. – khmarbaise Jul 31 '14 at 12:58
  • See also http://stackoverflow.com/questions/16685515/how-to-manage-maven-settings-xml-on-a-shared-jenkins-server/16703882#16703882 – Mark O'Connor Jul 31 '14 at 23:11
  • @khmarbaise I would setup repository manager if I could, in this case I can't – delor Aug 01 '14 at 03:16

1 Answers1

0

When you want to only install in the local repository, you should be using

mvn clean install

not

mvn clean deploy

Both of these build up until the install lifecycle phase, but the second one then tries to execute the deploy lifecycle phase. The install lifecycle phase is where artifacts are installed to the local repository, so deploy is not needed in this case. You also, as khmarbaise said, shouldn't be using a file path for the repository but instead a web path to a repository manager such as Nexus or Artifactory if you do want to deploy (i.e. don't use the local filesystem for this).

Jared
  • 1,887
  • 3
  • 20
  • 45