Maven无法使用多个存储库解析递归依赖关系 [英] Maven failing to resolve recursive dependencies with multiple repositories

查看:317
本文介绍了Maven无法使用多个存储库解析递归依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的,所以我必须有一些我不明白的东西。但是,我添加了多个存储库来解决我的POM文件中的多个依赖关系。由于某种原因,它在提取递归依赖性时失败。我依靠春天和春天取决于jms,它找不到jms。我不知道谁告诉maven哪里可以找到jms是我还是在POM里面呢?无论如何,我尝试添加另一个包含jms的存储库,但仍然说它找不到它。这是我的POM.xml:

 < project xmlns =http://maven.apache.org/POM/4.0 .0xmlns: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外部版本库< / name>
< url> http://repository.springsource.com/maven/bundles/external< / url>
< / repository>
< / repositories>

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

<依赖关系>
<依赖关系>
< groupId> junit< / groupId>
< artifactId> junit< / artifactId>
< version> 3.8.1< / version>
< scope> test< / scope>
< / dependency>

<依赖关系>
< groupId> mysql< / groupId>
< artifactId> mysql-connector-java< / artifactId>
< version> 5.1.18< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> log4j< / groupId>
< artifactId> log4j< / artifactId>
< version> 1.2.15< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> commons-collections< / groupId>
< artifactId> commons-collections< / artifactId>
< version> 3.2.1< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> commons-codec< / groupId>
< artifactId> commons-codec< / artifactId>
< version> 1.4< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> commons-logging< / groupId>
< artifactId> commons-logging< / artifactId>
< version> 1.1.1< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> commons-lang< / groupId>
< artifactId> commons-lang< / artifactId>
< version> 2.3< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> net.sf.flexjson< / groupId>
< artifactId> flexjson< / artifactId>
< version> 2.1< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> javax.mail< / groupId>
< artifactId> mail< / artifactId>
< version> 1.4.1< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> com.jcraft< / groupId>
< artifactId> jsch< / artifactId>
< version> 0.1.43< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> org.olap4j< / groupId>
< artifactId> olap4j< / artifactId>
< version> 1.0.0-SNAPSHOT< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> org.olap4j< / groupId>
< artifactId> olap4j-xmla< / artifactId>
< version> 1.0.0-SNAPSHOT< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> pentaho< / groupId>
< artifactId> mondrian< / artifactId>
< version> 3.3-SNAPSHOT< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-aop< / artifactId>
< version> $ {org.springframework.version}< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-asm< / artifactId>
< version> $ {org.springframework.version}< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-aspects< / artifactId>
< version> $ {org.springframework.version}< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-beans< / artifactId>
< version> $ {org.springframework.version}< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-context< / artifactId>
< version> $ {org.springframework.version}< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-context-support< / artifactId>
< version> $ {org.springframework.version}< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-core< / artifactId>
< version> $ {org.springframework.version}< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-expression< / artifactId>
< version> $ {org.springframework.version}< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-jdbc< / artifactId>
< version> $ {org.springframework.version}< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-jms< / artifactId>
< version> $ {org.springframework.version}< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-orm< / artifactId>
< version> $ {org.springframework.version}< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-oxm< / artifactId>
< version> $ {org.springframework.version}< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-tx< / artifactId>
< version> $ {org.springframework.version}< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-web< / artifactId>
< version> $ {org.springframework.version}< / version>
< scope>运行时< / scope>
< / dependency>

<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-webmvc< / artifactId>
< version> $ {org.springframework.version}< / version>
< scope>运行时< / 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>

我收到的失败消息是可怕的,但这里是:

  [ERROR]无法在项目存档器上执行目标:
无法解析
项目的依赖项com.fuseanalytics:archiver:war:1.0-SNAPSHOT:
以下工件无法解析:
javax.jms:jms:jar:1.1,
com.sun.jdmk:jmxtools: jar:1.2.1,
com.sun.jmx:jmxri:jar:1.2.1:
无法从/传送工件javax.jms:jms:jar:1.1
。 net(https://maven-repository.dev.java.net/nonav/repository):
无连接器可用于访问存储库
java.net(https://maven-repository.dev.java .net / nonav / repository)
类型legacy使用可用的工厂WagonRepositoryConnectorFactory
- > [帮助1]

为什么不能拉这个依赖关系?是HTTPS吗?当我浏览到URL(https://maven-repository.dev.java.net/nonav/repository)时,它不再存在。在这种情况下,我该怎么办?



已更新:原来我曾经问过一个略有不同的问题,但是认为是因为我有我的依赖关系的主机名中有错误的空间。一旦我删除,我遇到了一个新的错误消息。

解决方案

看起来你正在运行Maven 3+,你正在尝试访问旧版存储库。



Maven 3的一个令人讨厌但记录良好的变化是删除对旧版存储库的支持。您可以查看此兼容性说明和其他此处



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


旧版存储库的Maven 2.x兼容视图



I'm new to maven so there must be something I don't understand. But, I've added multiple repositories to resolve multiple dependencies in my POM file. For some reason its failing while pulling a recursive dependency. I'm dependent on spring and spring depends upon jms, and it can't find jms. I'm not sure who tells maven where to find jms is it me or is it inside the POM for spring? Anyway I've tried adding another repository that contains jms, but it still says it can't find it. Here is my 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>

The failure message I get is horrible to read, but here it is:

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

Why is it failing to pull this dependency? Is it the HTTPS? When I navigate to the URL (https://maven-repository.dev.java.net/nonav/repository) it is not there anymore. What do I do in this case?

Updated: Originally I had asked about a slightly different problem, but figured that how because I had an erroneous space in the hostname of my dependencies. Once I removed that I encountered a new error message.

解决方案

It looks like you are running Maven 3+ and you are trying to access a legacy repository.

One annoying but well documented change for Maven 3 was removing support for legacy repositories. You can check out this compatibility note and others here

If you are not depending completely on Maven 3 you can reduce to Maven 2.2.1 and this legacy issue should go away or follow what the link says and create a

Maven 2.x compatible view of the legacy repository

这篇关于Maven无法使用多个存储库解析递归依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆