Maven没有下载代理后面的罐子 [英] Maven not downloading jars behind proxy

查看:156
本文介绍了Maven没有下载代理后面的罐子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Maven无法在代理后面下载jar(s)(Dependency)。

Maven is unable to download jar (s) (Dependency) behind proxy.

这是我的pom.xml

Here is my pom.xml

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

     <modelVersion>4.0.0</modelVersion>

<groupId>com.faizan.firstbootapp.group1</groupId>
<artifactId>com-faizan-firstbootapp-group-1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>FirstBootApp</name>
<description>Test app for Maven build system</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.2.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

</project>

这是我在路径 C:\ Users \的settings.xml faizanmubasher\.m2\settings.xml 。我在其中添加了代理。

Here is my settings.xml at path C:\Users\faizanmubasher\.m2\settings.xml. I have added proxies in it.

<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
                      https://maven.apache.org/xsd/settings-1.0.0.xsd">
 <proxies>
  <proxy>
    <id>skm--http-proxy</id>
    <active>true</active>
    <protocol>http</protocol>
    <host>my.proxy.ip.here</host>
    <port>8080</port>
    <username>faizanmubasher</username>
    <password>*****</password>
  </proxy>
  <proxy>
    <id>skm--https-proxy</id>
    <active>true</active>
    <protocol>https</protocol>
    <host>my.proxy.ip.here</host>
    <port>8080</port>
    <username>faizanmubasher</username>
    <password>*****</password>
  </proxy>
 </proxies>
</settings>

用户名和密码是否正确。

Username and password are correct.

是因为我的办公室的代理不允许下载jar还是我需要配置一些Maven设置?

Is it due to my office's proxy that is not allowing to download jar or is it some Maven settings that I need to configure?

我在STS IDE上遇到此错误。

I am facing this error on STS IDE.

The container 'Maven Dependencies' references non existing library 'C:\Users\faizanmubasher\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.0.2.RELEASE\spring-boot-autoconfigure-2.0.2.RELEASE.jar'    FirstBootApp        Build path  Build Path Problem

我的Maven版本是Apache Maven 3.5.3。

My Maven version is Apache Maven 3.5.3.

编辑

命令设置MAVEN_OPTS = - DhttpProxyHost = xxx.xx.xx。 xx -DsocksProxyPort = 8080也不起作用。

推荐答案

试试这个,如果1不起作用尝试2,然后3:

Try this, if 1 does not work try 2, then 3:

1) First update the project, Alt-F5

2) Then go to your repo and blow away the directory for that dependency which should be in the directory C:\Users\faizanmubasher.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.0.2.RELEASE Then do an Alt-F5 again.

3) If this fails try a mvn clean install -U from the command line.

您可以使用以下命令测试您的maven到maven central repo连接:

You can test your maven to maven central repo connectivity with the following command:

mvn archetype:generate

你应该看到超过2000个原型返回

You should see over 2000 archetypes returned

这篇关于Maven没有下载代理后面的罐子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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