错误:Maven2RepositoryLayoutFactory:不支持的存储库布局遗留

时间:2015-08-21 09:30:33

标签: spring maven log4j

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

我的log4j几乎是空白的Spring项目。 Log4j以这种方式注册

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

2 个答案:

答案 0 :(得分:12)

我知道有两种解决方案:

  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>
    

答案 1 :(得分:0)

我发现解决此问题的唯一方法是使用简单的 maven 2 侧项目,将失败的依赖项放入其中。然后我针对这个项目运行 maven 2,依赖项下载正常,然后 maven 3 找到它们。

我尝试使用“始终”更新策略,但并不总是有效。