3

Google has just announced the availability of Maven Central mirror (article)

I have a Google App Engine Maven Java project and I already use Jenkins on Google Compute Engine to build and deploy my project.

Where should I put the settings.xml file in my project? Aside the pom.xml, in WEB-INF?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
Freddy Boucher
  • 1,387
  • 1
  • 16
  • 27

2 Answers2

1

The settings.xml file does not belong in your project. This is a private file that is kept on the filesystem and is not version-controled. When adding a mirror inside the settings, there is no reason for the POM to be modified.

There are two locations for the Maven settings:

  • The Maven install: $M2_HOME/conf/settings.xml.
  • A user's install: ${user.home}/.m2/settings.xml

The former settings.xml is called global settings (since it resides inside the Maven installation itself), while the latter is referred to as user settings. If both files exists, their contents gets merged, with the user-specific settings.xml being dominant.

I would suggest that you put this information inside your user settings, so as not to modify your Maven installation.

Tunaki
  • 132,869
  • 46
  • 340
  • 423
  • So it means I need to update my Google Compute Engine instance... It would be so much easier to include this settings in my project. I don't even know why it's not already part of the Jenkins image! I mean, I just selected the latest Jenkins image from Google selection. – Freddy Boucher Nov 10 '15 at 09:56
  • @FreddyBoucher This is file is really intended not to be distributed so it can't be included in the project. – Tunaki Nov 10 '15 at 10:02
0

As already answered, settings.xml is usually set for the user, in their home directory - this is because it usually holds credentials which you wouldn't put in a project and share via source control.

You can also specify repositories in your pom, which may be more appropriate to your use case. You can even activate them by profile, in case you want to use mvn central during dev and the Google mirror on CI.

Read more here

Nick
  • 1,822
  • 10
  • 9