Maven错误 - Glassfish vs Sun Jersey

时间:2016-08-11 06:01:31

标签: java maven jersey jetty

我正在尝试使用JettyJersey设置新的网络项目来实施休息服务。但是在尝试定义maven依赖项时我遇到了错误。

pom.xml

<dependencies>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-server</artifactId>
        <version>9.2.5.v20141112</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-servlet</artifactId>
        <version>9.2.5.v20141112</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-server</artifactId>
        <version>2.17</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-jetty-servlet</artifactId>
        <version>2.17</version>
    </dependency>
</dependencies>

我遇到了很多这样的错误:

Failed to read artifact descriptor for org.eclipse.jetty:
jetty-server:jar:9.2.5.v20141112

org.eclipse.aether.resolution.ArtifactDescriptorException: 
Failed to read artifact descriptor for org.eclipse.jetty:
jetty-server:jar:9.2.5.v20141112

但是,使用com.sun.jersey正在运行:

<dependency>
        <groupId>asm</groupId>
        <artifactId>asm</artifactId>
        <version>3.3.1</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-bundle</artifactId>
        <version>1.19</version>
    </dependency>
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20140107</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>1.19</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-core</artifactId>
        <version>1.19</version>
    </dependency>
</dependencies>

1 个答案:

答案 0 :(得分:0)

我不知道您指向的是哪个远程存储库,但我能够在http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-servlet/9.2.5.v20141112/找到该jar

如果您正在使用其他远程仓库,请尝试添加以下存储库。

<repositories>
    <repository>
      <id>central</id>
      <name>Maven Repository Switchboard</name>
      <layout>default</layout>
      <url>http://repo1.maven.org/maven2</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>