小编典典

带有Maven的Eclipse Java存储库:缺少工件:编译

java

我想intigrate jersey-servergrizzly-servlet- webserver进入我的Maven的webapp尝试与地狱世界JAX-RS。不幸的是,Jersey和Grizzly的依赖关系很麻烦,无法正常工作。

我尝试删除该.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文件

<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>

阅读 218

收藏
2020-11-23

共1个答案

小编典典

如果您明确运行Maven(与M2E自动运行相对),是否会看到相同的问题?如果不是,则可能需要更新项目配置(选择项目,右键单击,Maven..Update..Project配置和Maven..Update..Project依赖关系。

2020-11-23