Netbeans + Maven(更新中央存储库) [英] Netbeans + Maven (Updating Central Repositories)

查看:428
本文介绍了Netbeans + Maven(更新中央存储库)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于"HTTPS Required"错误,我最近在构建项目时遇到问题.如

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>

但是,为我拥有的每个项目更新每个pom.xml都是很麻烦的.

However, it is a hassle to update every pom.xml, for every project I have.

我尝试将相同的代码段添加到我的settings.xml中,但无济于事.

I have tried adding that same code snippet to my settings.xml, to no avail.

我知道Maven的较新版本可以解决此问题.但是,由于工作限制,我无法更新环境.

I am aware newer versions of Maven resolve this issue. However, due to work constraints, I'm unable to update my environment.

我目前已安装NetBeans 8.2安装程序捆绑提供的Java 8和Maven.

I have currently installed Java 8, and Maven, as bundled by Netbeans 8.2 Installer.

是否可以添加一些内容到我的settings.xml中,以避免修改我工作的每个pom.xml? 如果绝对必要,是否知道我与Netbeans一起安装了什么,是否可以更新我的Maven版本?

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.

推荐答案

如果您使用捆绑了maven的NetBeans 8.0(8.1,8.2),也可以编辑settings.xml.例如,对于与NetBeans 8.1捆绑在一起的Maven,该文件应位于目录 C:\ Program Files(x86)\ NetBeans 8.1 \ java \ maven \ conf 中.

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.

只需添加一个具有https协议的镜像,即可.

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>

如果您有许多pom.xml文件,则在一个地方编辑存储库设置会更好. 另外,请考虑更新为 NetBeans 11.0 LTS或最新的Maven .

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.

这篇关于Netbeans + Maven(更新中央存储库)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆