我正在尝试编译maven项目,但我系统地收到以下错误消息:
[ERROR]Failed to execute goal on project ...:
Could not resolve dependencies for project ...:war:1.0.0:
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:
Failure to find javax.jms:jms:jar:1.1 in http://mirrors.ibiblio.org/maven2/
was cached in the local repository, resolution will not be reattempted until
the update interval of maven2-repository.ibiblio.mirror has elapsed or
updates are forced -> [Help 1]
Run Code Online (Sandbox Code Playgroud)
我知道关于Sun罐子的这个maven帖子,但它没有解决问题.
有没有人有办法解决吗?我可以在我的pom.xml中指定一个存储库吗?
谢谢!
Jér*_*nge 80
谢谢你的建议.我终于找到了解决这个问题后阅读此.事实证明,这些依赖关系来自对ZooKeeper的依赖.
我修改了我的pom.xml如下,它解决了问题:
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.3.2</version>
<exclusions>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
</exclusions>
</dependency>
Run Code Online (Sandbox Code Playgroud)
mat*_*tto 58
如果有人仍然想使用jms1.1然后添加公共jboss存储库,maven将找到它...
项目 - >相关性:
<dependencies>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
项目 - >库:
<repositories>
<repository>
<id>repository.jboss.org-public</id>
<name>JBoss.org Maven repository</name>
<url>https://repository.jboss.org/nexus/content/groups/public</url>
</repository>
Run Code Online (Sandbox Code Playgroud)
有用 -
F:\mvn-repo-stuff>mvn verify
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mvn-repo-stuff 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/javax/jms/jms/1.1/jms-1.1.pom
Downloaded: http://repo1.maven.org/maven2/javax/jms/jms/1.1/jms-1.1.pom (677 B at 0.8 KB/sec)
[WARNING] The artifact xml-apis:xml-apis:jar:2.0.2 has been relocated to xml-apis:xml-apis:jar:1.0.b2
Downloading: http://repo1.maven.org/maven2/javax/jms/jms/1.1/jms-1.1.jar
Downloading: https://repository.jboss.org/nexus/content/groups/public/javax/jms/jms/1.1/jms-1.1.jar
Downloaded: https://repository.jboss.org/nexus/content/groups/public/javax/jms/jms/1.1/jms-1.1.jar (26 KB at 8.5 KB/sec)
Run Code Online (Sandbox Code Playgroud)
R-J*_*ANA 23
Log4版本1.2.17自动解决问题,因为它依赖于geronimo-jms.我在log4j-1.2.15版本中遇到了同样的问题.
围绕该问题添加了更多
使用1.2.17解决了编译期间的问题,但服务器(Karaf)使用1.2.15版本,因此在运行时产生冲突.因此我不得不切换回1.2.15.
JMS和JMX api在运行时可用,因此我没有导入J2ee api.
我所做的是我在1.2.17上使用了编译时依赖,但在运行时删除了它.
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
....
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Import-Package>!org.apache.log4j.*,*</Import-Package>
.....
Run Code Online (Sandbox Code Playgroud)
Adr*_*ico 13
另一种解决方案,如果您不想修改您的设置:
从JBoss存储库下载jms-1.1.jar然后:
mvn install:install-file -DgroupId=javax.jms -DartifactId=jms -Dversion=1.1 -Dpackaging=jar -Dfile=jms-1.1.jar