我正在尝试使用 Maven Central 导入 Jersey ,但是 intellij 不会读取我的 Jersey 的 pom.xml 依赖项。版本号显示为红色,并出现以下错误:
这里是 pom.xml 的文本:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.emanuel</groupId>
<artifactId>jerseyexample</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>jerseyexample Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.19</version>
</dependency>
</dependencies>
<build>
<finalName>jerseyexample</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<server>TomcatServer</server>
<path>/newjersey</path>
</configuration>
</plugin>
</plugins>
</build>
</project>
我直接从 here 复制了依赖项
最佳答案
问题出在我的 settings.xml 文件上,maven 使用它来构建项目。我在那里定义了一个使用代理的镜像,它阻止了下载。
关于java - maven pom.xml 文件无法识别 Jersey 框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31361024/