Maven无法在代理后面下载jar(依赖项)。
这是我的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>
这是我的settings.xml,位于路径C:\Users\faizanmubasher\.m2\settings.xml
。我在其中添加了代理。
<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>
用户名和密码正确。
是因为我的办公室的代理不允许下载jar,还是我需要配置某些Maven设置?
我在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。
编辑
命令set MAVEN_OPTS="-DhttpProxyHost=xxx.xx.xx.xx -DsocksProxyPort=8080"
不能正常工作。
答案 0 :(得分:1)
尝试一下,如果1不起作用,请尝试2,然后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中央存储库的连接性:
mvn archetype:generate
您应该看到返回了2000多个原型
答案 1 :(得分:0)
我正在尝试使用http代理访问Maven https 存储库。
在这里,maven的jira中存在较新版本的问题。
https://issues.apache.org/jira/browse/PROXY-27