使用Maven的Java Java存储库:缺少工件:编译

时间:2011-07-14 16:36:00

标签: java eclipse maven-2 maven jax-rs

我正在尝试将jersey-servergrizzly-servlet-webserver投射到我的Maven Webapp中,以JAX-RS尝试一个地狱世界。不幸的是,泽西岛和灰熊队的依赖都很麻烦,而且没有用。

我尝试删除.m2文件夹,因为我认为它可能已损坏但没有帮助。我添加了其他依赖项,如jsoup,工作正常。在日志中,它实际上从存储库下载了jersey-server,因此它不是网络问题。

任何人都可以帮助我吗?我真的被卡住了!

我的Eclipse日志:

14.07.11 18:31:33 MESZ: Refreshing [/server/pom.xml]
14.07.11 18:31:33 MESZ: Missing artifact com.sun.jersey:jersey-server:jar:1.8:compile
14.07.11 18:31:33 MESZ: Missing artifact com.sun.grizzly:grizzly-servlet-webserver:jar:1.9.18-i:compile
14.07.11 18:31:33 MESZ: Missing artifact com.sun.grizzly:grizzly-utils:jar:1.9.18-i:compile
14.07.11 18:31:33 MESZ: Maven Builder: AUTO_BUILD 
14.07.11 18:31:42 MESZ: Updated index for central|http://repo1.maven.org/maven2

...下载的早期部分:

.07.11 18:08:25 MESZ: Downloaded http://download.java.net/maven/2/javax/servlet/servlet-api/2.5/servlet-api-2.5.pom
14.07.11 18:08:26 MESZ: Downloading http://repo1.maven.org/maven2/javax/servlet/servlet-api/2.5/servlet-api-2.5.pom
14.07.11 18:08:26 MESZ: Downloaded http://repo1.maven.org/maven2/javax/servlet/servlet-api/2.5/servlet-api-2.5.pom
14.07.11 18:08:27 MESZ: Downloading http://download.java.net/maven/2/com/sun/jersey/jersey-server/1.8/jersey-server-1.8.jar
14.07.11 18:08:27 MESZ: Downloaded http://download.java.net/maven/2/asm/asm/3.1/asm-3.1.jar
14.07.11 18:08:28 MESZ: Downloading http://download.java.net/maven/2/com/sun/jersey/jersey-core/1.8/jersey-core-1.8.jar
14.07.11 18:08:29 MESZ: Downloading http://download.java.net/maven/2/com/sun/grizzly/grizzly-servlet-webserver/1.9.18-i/grizzly-servlet-webserver-1.9.18-i.jar
14.07.11 18:08:30 MESZ: Downloading http://download.java.net/maven/2/com/sun/grizzly/grizzly-http/1.9.18-i/grizzly-http-1.9.18-i.jar
14.07.11 18:08:31 MESZ: Downloading http://download.java.net/maven/2/com/sun/grizzly/grizzly-framework/1.9.18-i/grizzly-framework-1.9.18-i.jar
14.07.11 18:08:33 MESZ: Downloading http://download.java.net/maven/2/com/sun/grizzly/grizzly-rcm/1.9.18-i/grizzly-rcm-1.9.18-i.jar
14.07.11 18:08:34 MESZ: Downloaded http://download.java.net/maven/2/com/sun/grizzly/grizzly-rcm/1.9.18-i/grizzly-rcm-1.9.18-i.jar
14.07.11 18:08:35 MESZ: Downloading http://download.java.net/maven/2/com/sun/grizzly/grizzly-portunif/1.9.18-i/grizzly-portunif-1.9.18-i.jar
14.07.11 18:08:37 MESZ: Downloading http://download.java.net/maven/2/com/sun/grizzly/grizzly-http-servlet/1.9.18-i/grizzly-http-servlet-1.9.18-i.jar
14.07.11 18:08:37 MESZ: Downloading http://download.java.net/maven/2/com/sun/grizzly/grizzly-utils/1.9.18-i/grizzly-utils-1.9.18-i.jar
14.07.11 18:08:38 MESZ: Downloaded http://download.java.net/maven/2/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar

的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.e.api</groupId>
    <artifactId>server</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>server 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>com.sun.jersey</groupId>
            <artifactId>jersey-server</artifactId>
            <version>1.8</version>
        </dependency>
        <dependency>
            <groupId>com.sun.grizzly</groupId>
            <artifactId>grizzly-servlet-webserver</artifactId>
            <version>1.9.18-i</version>
        </dependency>
    </dependencies>
<build>
    <finalName>server</finalName>
    <plugins>
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
        </plugin>
    </plugins>
</build>
    <repositories>
        <repository>
            <id>maven2-repository.java.net</id>
            <name>Java.net Repository for Maven</name>
            <url>http://download.java.net/maven/2/</url>
            <layout>default</layout>
        </repository>
        <repository>
            <id>maven-repository.java.net</id>
            <name>Java.net Maven 1 Repository (legacy)</name>
            <url>http://download.java.net/maven/1</url>
            <layout>legacy</layout>
        </repository>
    </repositories>
</project>

1 个答案:

答案 0 :(得分:2)

如果你明确地运行Maven(而不是M2E自动运行),你会看到同样的问题吗?如果没有,您可能需要更新项目配置(选择proj,右键单击,Maven..Update..Project配置和Maven..Update..Project依赖项。