I would like to secure the connection to repo.maven.apache.org
when resolving dependencies (I wolud like to secure all connections made by Maven actually), but I'm not used to Maven configuration... My user settings.xml
contains the following repositories
and pluginRepositories
sections:
<profiles>
<profile>
<id>main</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo.maven.apache.org</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://repo.maven.apache.org</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
However Maven is unable to resolve dependencies with that setup.
By default, Maven uses the java. net. URLConnection ( HttpURLConnection ) classes provided with the JDK to access repositories that use the HTTP/HTTPs protocols.
Maven central repository is located at http://repo.maven.apache.org/maven2/. Whenever you run build job, maven first try to find dependency from local repository. If it is not there, then, by default, maven will trigger the download from this central repository location.
Open the file $MAVEN_HOME/conf/settings.xml
(where $MAVEN_HOME
is the folder in which Maven has been installed) in a text editor. Then, add the following to the <mirrors>...</mirrors>
section in this file:
<mirror>
<id>central-secure</id>
<url>https://repo.maven.apache.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With