BenMansourNizar
BenMansourNizar

Reputation: 1628

Change maven default repository

in my company we have a proxy that inhibits downloading jars so evrey time i download a jar using maven i discover that it was corrupted.but i can download jars from https servers. My problem is that evrey time i use maven it always downloading from this repo http://repo1.maven.org/maven2/org/apache/maven i don't find it in setting.xml so i can change it with https://search.maven.org/ How can i change it Thanks in advance

Upvotes: 2

Views: 5288

Answers (3)

Metalhead
Metalhead

Reputation: 1449

You can solve the jar download issue by defining proxy settings in settings.xml. My company also used a proxy to communicate with outside world.Having said that, I also learnt that there is no need to define specific remote repository in settings.xml bcos maven by default searches in its own repository which mostly has all the opensource jars. Try below configuration in your setting.xml and issue will be solved.

<proxy>
  <active>true</active>
  <protocol>http</protocol>
  <host>proxy.somewhere.com</host>
  <port>8080</port>
  <username>proxyuser</username>
  <password>somepassword</password>
</proxy>

Upvotes: 0

khmarbaise
khmarbaise

Reputation: 97547

The most important step you should go is to use a Repository Manager and use this instead using direct connection to internet. There different solutions available like Nexus, Artifactory, Archiva. The problem your are describing are typical problems within commerial environments and of course the solution is to use a repository manager.

Upvotes: 1

Sri Sankaran
Sri Sankaran

Reputation: 8330

I don't think pointing to https://search.maven.org is going to solve your issue. That is just a human consumable (yes along with bookmarkable and searchable-by-REST) search location.

That said, the definition of central is in the Maven super POM that is part of the Maven installation. You can mirror this repository if you wish to point your Maven installation to a different central repository.

Upvotes: 1

Related Questions