我的project1和project2在使用Maven构建时工作正常。最近,我使用了这个tutorial从maven2升级到了maven3(我在maven2上进行了检查,但是它也不起作用)。对于具有 private (自行托管)Nexus存储区的project2,一切正常,并且工作正常。

但是,现在下载项目1的依赖项时出现错误(使用 public Maven存储库)。

我的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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.dds.server.DDSStartup</groupId>
    <artifactId>storage</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>storage</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>r07</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.16</version>
        </dependency>
        <dependency>
            <groupId>com.sleepycat</groupId>
            <artifactId>je</artifactId>
            <version>3.3.75</version>
        </dependency>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>jgroups</groupId>
            <artifactId>jgroups-all</artifactId>
            <version>2.4.1</version>
        </dependency>
    </dependencies>


    <repositories>
        <repository>
            <id>oracleReleases</id>
            <name>Oracle Released Java Packages</name>
            <url>http://download.oracle.com/maven</url>
            <layout>default</layout>
        </repository>
    </repositories>
</project>

我要去哪里了,这是我执行:mvn clean package时遇到的错误
[ERROR] Failed to execute goal on project storage: Could not resolve dependencies for project com.dds.server.DDSStartup:DynamicDistributedStorage:jar:1.0-SNAPSHOT: Failed to collect dependencies for [junit:junit:jar:3.8.1 (test), com.google.guava:guava:jar:r07 (compile), log4j:log4j:jar:1.2.16 (compile), com.sleepycat:je:jar:3.3.75 (compile), com.google.protobuf:protobuf-java:jar:2.3.0 (compile), jgroups:jgroups-all:jar:2.4.1 (compile)]: Failed to read artifact descriptor for log4j:log4j:jar:1.2.6: Could not transfer artifact log4j:log4j:pom:1.2.6 from/to oracleReleases (http://download.oracle.com/maven): /Users/username/.m2/repository/log4j/log4j/1.2.6/log4j-1.2.6.pom.ahc65d8d087349b4a46 (No such file or directory) -> [Help 1]

更新:

我删除了所有内容(工作区),再次导入了该项目,它的工作原理很吸引人。没有什么可以击败该解决方案的! ;)

最佳答案

这也不应该与maven2一起使用。

根据错误消息,看来maven正在尝试从pom中指定的存储库中下载依赖项-oracleReleases(http://download.oracle.com/maven),而不是 public Maven存储库。这似乎是无效的存储库URL。

也许您应该尝试删除该部分并重试。

08-05 08:09