Maven无法解决多个存储库的递归依赖关系

chu*_*ubs 21 dependencies maven-2 repository

我是maven的新手所以必须有一些我不理解的东西.但是,我添加了多个存储库来解析我的POM文件中的多个依赖项.由于某种原因,它在拉动递归依赖时失败了.我依赖于春天和春天取决于jms,它找不到jms.我不确定是谁告诉maven在哪里可以找到jms是我还是它在POM内弹簧?无论如何,我已经尝试添加另一个包含jms的存储库,但它仍然说它无法找到它.这是我的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.mycompany</groupId>
    <artifactId>app</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>app</name>
    <url>http://maven.apache.org</url>
    <repositories>
        <repository>
            <id>sonatype-nexus-snapshots</id>
            <name>Sonatype</name>
            <url>http://repository.sonatype.org</url>
        </repository>
        <repository>
            <snapshots/>
            <id>repo.pentaho.org</id>
            <name>repo.pentaho.org-snapshots</name>
            <url>http://repository.pentaho.org/artifactory/pentaho</url>
        </repository>
        <repository>
            <id>thirdparty.pentaho.org</id>
            <name>repo.pentaho.org-snapshots</name>
            <url>http://repository.pentaho.org/artifactory/thirdparty</url>
        </repository>
        <repository>
            <id>com.springsource.repository.bundles.release</id>
            <name>EBR Spring Release Repository</name>
            <url>http://repository.springsource.com/maven/bundles/release</url>
        </repository>
        <repository>
            <id>com.springsource.repository.bundles.external</id>
            <name>EBR External Release Repository</name>
            <url>http://repository.springsource.com/maven/bundles/external</url>
        </repository>
    </repositories>

    <properties>
        <org.springframework.version>3.0.5.RELEASE</org.springframework.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.18</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.15</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.2.1</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.4</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1.1</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.3</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>net.sf.flexjson</groupId>
            <artifactId>flexjson</artifactId>
            <version>2.1</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.1</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>com.jcraft</groupId>
            <artifactId>jsch</artifactId>
            <version>0.1.43</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.olap4j</groupId>
            <artifactId>olap4j</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.olap4j</groupId>
            <artifactId>olap4j-xmla</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>pentaho</groupId>
            <artifactId>mondrian</artifactId>
            <version>3.3-SNAPSHOT</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${org.springframework.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-asm</artifactId>
            <version>${org.springframework.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <version>${org.springframework.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${org.springframework.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${org.springframework.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${org.springframework.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${org.springframework.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
            <version>${org.springframework.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${org.springframework.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jms</artifactId>
            <version>${org.springframework.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${org.springframework.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-oxm</artifactId>
            <version>${org.springframework.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${org.springframework.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${org.springframework.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework.version}</version>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
Run Code Online (Sandbox Code Playgroud)

我得到的失败信息很难阅读,但这里是:

[ERROR] Failed to execute goal on project archiver:
    Could not resolve dependencies for
    project com.fuseanalytics:archiver:war:1.0-SNAPSHOT:
    The following artifacts could not be resolved:
    javax.jms:jms:jar:1.1,
    com.sun.jdmk:jmxtools:jar:1.2.1,
    com.sun.jmx:jmxri:jar:1.2.1:
    Could not transfer artifact javax.jms:jms:jar:1.1
    from/to java.net (https://maven-repository.dev.java.net/nonav/repository):
    No connector available to access repository
    java.net (https://maven-repository.dev.java.net/nonav/repository)
    of type legacy using the available factories WagonRepositoryConnectorFactory
    -> [Help 1]
Run Code Online (Sandbox Code Playgroud)

为什么它没有拉动这种依赖?是HTTPS吗?当我导航到URL(https://maven-repository.dev.java.net/nonav/repository)时,它就不再存在了.在这种情况下我该怎么办?

更新: 最初我问过一个稍微不同的问题,但想到了怎么样因为我的依赖主机名中有一个错误的空间.删除后,我遇到了一条新的错误消息.

小智 23

刚刚遇到这个问题:log4j版本1.2.15导致了这个问题.使用log4j版本1.12.16可以解决此问题.请参阅Missing artifact com.sun.jdmk:jmxtools:jar:1.2.1


Joh*_*int 12

看起来您正在运行Maven 3+并且您正在尝试访问旧版存储库.

Maven 3的一个令人烦恼但记录良好的变化是删除了对遗留存储库的支持.您可以在此处查看此兼容性说明和其他说明

如果你不完全依赖Maven 3,你可以减少到Maven 2.2.1,这个遗留问题应该消失或者按照链接所说的那样创建一个

Maven 2.x兼容遗留存储库的视图

  • 谢谢你的回复.我最终没有降级,并在依赖关系上使用排除来关闭传递依赖关系,如jms等.我不知道这对包装究竟做了什么,因为我可能需要运行这些东西.如果我们无法获取sun jar文件,因为它们位于旧的maven 1布局上,这似乎是Maven3采用的一个严重问题.在我开始之前我并不喜欢maven,这种经历并没有改变我的观点.我喜欢依赖管理,但它一直很头疼. (4认同)

Vic*_*Vic 11

我可能会晚一点,但使用log4j 1.2.15的人可能会在将来搜索它.这个问题解决了:

<dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.15</version>
        <exclusions>
            <exclusion>
                <groupId>javax.jms</groupId>
                <artifactId>jms</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.jmx</groupId>
                <artifactId>jmxri</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.jdmk</groupId>
                <artifactId>jmxtools</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
Run Code Online (Sandbox Code Playgroud)