简体   繁体   English

Maven代理错误

[英]Maven Proxy error

Hi I am not able to create Maven Project in my machine.Below are my configurations 嗨,我无法在我的机器上创建Maven Project。以下是我的配置

Eclipse Version: Mars.1 Release (4.5.1)
Maven Version: m2e, Maven Integration for Eclipse, 1.6.2

I am behind a corporate proxy. 我在公司代理后面。 I have tried to configure the settings file inside .m2 directory and it is not working. 我试图在.m2目录中配置设置文件,但它不起作用。 Below is my settings file 以下是我的设置文件

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

<proxies>
 <proxy>
 <id>myproxy</id>
 <active>true</active>
 <protocol>http</protocol>
 <host>XX.XX.XX.XX</host>
 <port>8080</port>
 <nonProxyHosts></nonProxyHosts>
 <username>USERNAME</username>
 <password>PASSWORD</password>
 </proxy>
 </proxies>

</settings>

I saw lot of answers in StackOverflow regarding this issue, I tried and nothing works. 我在StackOverflow中看到了很多与此问题有关的答案,但我尝试了一下,但没有任何效果。 I doubt, there is '@' character in my PASSWORD, does it cause any issues ? 我怀疑密码中是否包含“ @”字符,是否会引起任何问题? Also do we need to provide USERNAME as domain\\USERNAME or only USERNAME ? 另外,我们是否需要提供USERNAME作为domain \\ USERNAME或仅提供USERNAME? And how to provide both http and https in the file ? 以及如何在文件中同时提供http和https?

Stack Trace error 堆栈跟踪错误

Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 from any of the configured repositories.
Could not resolve artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0
Failure to transfer org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from/to central (https://repo.maven.apache.org/maven2): connect timed out

In my experience. 在我的经验中。

  1. The '@" character is not the key problem. Since my pwd also include this character. “ @”字符不是关键问题,因为我的密码也包含此字符。
  2. Domain is not necessary to add 域不是必须添加
  3. Actually maybe you can try this way: 实际上,您可以尝试以下方式:

Config proxy information in your IDE (eg:eclipse) instead of config in settgins.xml which means remove all the configuration in your maven setting file 在IDE中配置代理信息(例如:eclipse),而不是settgins.xml中的config,这意味着删除maven设置文件中的所有配置

Just change your maven installtion that solves problem 只需更改您的Maven安装即可解决问题

  1. Download maven binaries and extract it and set path variable accordingly. 下载Maven二进制文件并解压缩并相应地设置路径变量。

  2. check on command prompt or terminal by typing mvn that it works! 通过键入mvn来检查命令提示符或终端是否有效!

  3. edit settings.xml inside that extracted binary package conf directory. 在提取的二进制软件包conf目录中编辑settings.xml。

  4. navigate to windows -> preferences -> maven preferences -> Installtions 导航到Windows->首选项-> Maven首选项->安装

  5. add new installtion with proper path to that extracted maven binary folder. 将具有正确路径的新安装添加到该提取的maven二进制文件夹。

that is it you will not face any problem anymore! 就是这样,您将不再面临任何问题!

In my case I just did the below steps and its worked. 就我而言,我只是按照以下步骤操作。

  1. Mentioned the proxy details in eclipse and maven(/user/.m2/settings.xml) 在Eclipse和Maven中提到了代理详细信息(/user/.m2/settings.xml)
  2. Then removed all the *.lastupdated files from /user/.m2/repository 然后从/user/.m2/repository中删除所有* .lastupdated文件
  3. Afterwards its worked fine 后来它工作正常

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM