gpt4 book ai didi

eclipse - pom.xml 在包含 log4j 依赖项时显示多个错误

转载 作者:行者123 更新时间:2023-12-04 13:11:33 25 4
gpt4 key购买 nike

我刚刚创建了一个新的 java 项目,并在 eclipse 中将其配置为“maven 项目”。 pom.xml 文件是自动生成的。在这一点上它没有错误。我在自动生成的 pom.xml 文件中添加了 log4j 依赖项,它显示了 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>Log4JPactice</groupId>
<artifactId>Log4JPactice</artifactId>
<version>0.0.1-SNAPSHOT</version>

<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>

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

错误:
Multiple annotations found at this line:
- Missing artifact javax.jms:jms:jar:1.1
- ArtifactTransferException: Failure to transfer com.sun.jdmk:jmxtools:jar:1.2.1 from https://maven-repository.dev.java.net/nonav/repository was cached in the local repository, resolution will not be reattempted until the update interval of java.net has elapsed or
updates are forced. Original error: Could not transfer artifact com.sun.jdmk:jmxtools:jar:1.2.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 AsyncRepositoryConnectorFactory, WagonRepositoryConnectorFactory
- ArtifactTransferException: Failure to transfer javax.jms:jms:jar:1.1 from https://maven-repository.dev.java.net/nonav/repository was cached in the local repository, resolution will not be reattempted until the update interval of java.net has elapsed or updates are
forced. Original error: 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 AsyncRepositoryConnectorFactory, WagonRepositoryConnectorFactory
- ArtifactTransferException: Failure to transfer com.sun.jmx:jmxri:jar:1.2.1 from https://maven-repository.dev.java.net/nonav/repository was cached in the local repository, resolution will not be reattempted until the update interval of java.net has elapsed or updates
are forced. Original error: Could not transfer artifact com.sun.jmx:jmxri:jar:1.2.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 AsyncRepositoryConnectorFactory, WagonRepositoryConnectorFactory
- Missing artifact com.sun.jdmk:jmxtools:jar:1.2.1
- Missing artifact com.sun.jmx:jmxri:jar:1.2.1

使用的 Eclipse:Eclipse Juno

对这个错误有什么想法吗?

更新:
正在运行 mvn install从命令行我收到以下错误:
    Failed to execute goal on project Log4JPactice: Could not resolve dependencies for project Failed to execute goal on project Log4JPactice: Could not resolve dependencies 
for project Log4JPactice:Log4JPactice:jar:0.0.1-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 AsyncRepositoryConnectorFactory, WagonRepositoryConnectorFactory -> [Help 1]

最佳答案

您可以排除这些依赖项,因为您可能不需要它们

<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
</exclusions>
</dependency>

关于eclipse - pom.xml 在包含 log4j 依赖项时显示多个错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20611991/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com