java - maven pom.xml 文件无法识别 Jersey 框架

标签 java xml maven intellij-idea

我正在尝试使用 Maven Central 导入 Jersey ,但是 intellij 不会读取我的 Jersey 的 pom.xml 依赖项。版本号显示为红色,并出现以下错误:

enter image description here

这里是 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/

相关文章:

java - 修改进度条资源图片

java - JDBC DatabaseMetaData 说我的 mysql 服务器不支持 namedParameters 并因此抛出空指针异常

c# - C#XML合并(2个以上文件)

java - 如何修复 1 字节 UTF-8 序列的无效字节 1

maven - JDK7,mvn-3.2.2 - maven-enforcer-plugin - RequireJavaVersion 失败

java - openIMAJ 缺少类或错误的库

Java 字符串 HTTP 编码

c# - 是否存在用于两个 XmlDocuments 的 .NET XPath 'diff' 命令?

java - Jersey2 样本休息服务失败

java - Maven CAS 和 Restfullapi