问题
I recently faced issues building my project due to "HTTPS Required" error. This issue was solved by modifying my pom.xml as described here, adding the following:
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
However, it is a hassle to update every pom.xml, for every project I have.
I have tried adding that same code snippet to my settings.xml, to no avail.
I am aware newer versions of Maven resolve this issue. However, due to work constraints, I'm unable to update my environment.
I have currently installed Java 8, and Maven, as bundled by Netbeans 8.2 Installer.
Is there something I can add to my settings.xml to avoid modifying every pom.xml I work on? If absolutely necessary, is there a way I can update just my maven version, knowing I have whatever is installed along with Netbeans?
Hope this isn't a duplicate, I have searched several entries, all to no avail.
回答1:
If you are using NetBeans 8.0 (8.1,8.2) with bundled maven
also you could edit settings.xml
. For example, for bundled maven with NetBeans 8.1, the file should be in directory C:\Program Files (x86)\NetBeans 8.1\java\maven\conf.
Just add another mirror with https protocol like that.
<mirrors>
<mirror>
<id>mirrorId</id>
<mirrorOf>central</mirrorOf>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
</mirror>
</mirrors>
If you have many pom.xml files editing repository settings in one place is better. Also, consider updating to NetBeans 11.0 LTS or latest Maven.
来源:https://stackoverflow.com/questions/60084842/netbeans-maven-updating-central-repositories