错误:Maven2RepositoryLayoutFactory:不支持的仓库布局legacy。

9

我从Maven收到以下错误信息:

[ERROR] Failed to execute goal on project battleships: Could not resolve dependencies for project com.miteff.travelex:battleships:wa
r:2.0.0-BUILD-SNAPSHOT: The following artifacts could not be resolved: javax.jms:jms:jar:1.1, com.sun.jdmk:jmxtools:jar:1.2.1, com.s
un.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/no
nav/repository): Cannot access https://maven-repository.dev.java.net/nonav/repository with type legacy using the available connector
 factories: BasicRepositoryConnectorFactory: Cannot access https://maven-repository.dev.java.net/nonav/repository with type legacy u
sing the available layout factories: Maven2RepositoryLayoutFactory: Unsupported repository layout legacy -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

我有一个几乎空白的Spring项目,其中包含log4j。Log4j是这样注册的:

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

在pom.xml中显示您的存储库配置。 - Jens
pom.xml 中没有添加额外的存储库。 - JRr
2个回答

18

我知道两个解决方案:

  1. 将log4j版本更新为1.2.17可解决该问题。
  2. 保持log4j版本为1.2.15,但通过添加运行时作用域来解决问题,方法如下:

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

谢谢@joro,你刚刚为我节省了一些时间!;) - Archer
还有一种方法,请参见https://crunchify.com/maven-artifacts-error-jms-jmxtools-jmxri-dependencies/。 - T. Cervenka

0
我发现解决这个问题的唯一方法是创建一个简单的Maven 2项目,将失败的依赖项放入其中。然后我运行Maven 2来构建这个项目,依赖项可以正常下载,然后Maven 3就能找到它们了。
我尝试使用更新策略“always”,但并不总是有效。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接