Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven mvn安装错误再次出现_Maven - Fatal编程技术网

Maven mvn安装错误再次出现

Maven mvn安装错误再次出现,maven,Maven,mvn安装 我得到以下错误 [ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org. apache.maven.plugins:maven-resources-plugin:jar:2.5: Could not transfer ar

mvn安装 我得到以下错误

[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its
 dependencies could not be resolved: Failed to read artifact descriptor for org.
apache.maven.plugins:maven-resources-plugin:jar:2.5: Could not transfer artifact
 org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central (http:/
/repo.maven.apache.org/maven2): Connection to http://repo.maven.apache.org refus
ed: Connection timed out: 
我尝试使用堆栈中的早期答案设置代理,但仍然面临问题。 需要清晰的单步帮助。

解决方案:

将以下依赖项添加到pom.xml:

<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.5</version>
</dependency>

org.apache.maven.plugins
maven资源插件
2.5
然后在命令提示符下运行“mvn clean install”

刷新(F5)后,在eclipse中升级项目配置(运行>Maven>更新项目配置)。

在.m2文件夹中添加一个global settings.xml(示例将在mvn.home/conf/settings.xml中提供),该文件夹位于c:/user/username/.m2中。。 在中的settings.xml中添加以下条目

  <pluginRepositories>

                                    <pluginRepository>
                                            <id>central</id>
                                            <name>Maven Plugin Repository</name>
                                            <url>http://repo1.maven.org/maven2</url>
                                            <releases>
                                                    <enabled>false</enabled>
                                            </releases>
                                            <snapshots>
                                                    <enabled>false</enabled>
                                            </snapshots>
                                    </pluginRepository>

                            </pluginRepositories>

中心的
Maven插件库
http://repo1.maven.org/maven2
假的
假的

这将解决上述问题。

面临同样的问题。发生这种情况的原因是缓存的文件。对我有效的是删除存储库文件夹的内容。它确实在下一次构建时再次下载了所有文件,但解决了问题。

我也遇到了由代理设置引起的相同问题。我在
/conf/settings.xml中的maven安装目录下的
setting.xml
文件中添加了我的代理设置,解决了这个问题

<proxies>
    <proxy>
        <id>optional</id>
        <active>true</active>
        <protocol>http</protocol>
        <username>xxxx</username>
        <password>xxxxx</password>
        <host>xxxxxxx</host>
        <port>xxxx</port>
        <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
</proxies>

可选择的
真的
http
xxxx
xxxxx
xxxxxxx
xxxx
local.net | some.host.com
在eclipse中转到窗口-->首选项-->Maven--> 取消选择选项“不自动更新远程存储库中的依赖项”


这样做对我来说已经成功了。然后,我可以下载所有依赖项。

我通过在我的

settings.xml

可在
C:\Program Files\Apache\maven\Apache-maven-3.3.9\conf中找到的文件

<proxies>
<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>https</protocol>
  <host>xxxxxxxxxx</host>
  <port>xxxx</port>
  <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>

希望这能有所帮助。

您是否支持代理?没有帮助我解决问题:(@Umasankar pardhan,我的邻居:(
C:\Program Files\Apache\maven\apache-maven-3.3.9\conf\settings.xml