我们本地的 Nexus 存储库在下载依赖项时似乎不一致。它会拉下pom,甚至测试 jar 等......但不是我需要的主要实际 jar !因此,当我在我们的中心(代理)存储库中浏览 drools-compiler: org/drools/drools-compiler 的索引时,我会看到以下文件:
缺少的关键文件是:
drools-compiler-6.2.0.CR4.jar
当我浏览远程时,一切都在那里,包括关键的 jar 。
当我运行
mvn clean install
(通过我的 IDE STS 3.6.3),我最终看到以下错误消息:Failed to execute goal on project :
Could not resolve dependencies for project :
Failed to collect dependencies at org.drools:drools-compiler:jar:6.2.0.CR4:
Failed to read artifact descriptor for org.drools:drools-compiler:jar:6.2.0.CR4:
Failure to find org.jboss.dashboard-builder:dashboard-builder-bom:pom:6.2.0.CR4 in was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced
过去有很多其他的依赖项已经被删除,存储库已经存在了很长时间(我没有设置它,只是现在处理!)...... JBoss 流口水并不是唯一的时间我看到了,这只是我现在最紧迫的问题。
我搜索了一下,有些帖子似乎相关,(这 one 几乎相同但未解决)但似乎无法找到解决方案。在我们的本地 Jboss 和 Central 代理中设置了远程索引下载。我曾尝试清除缓存、重建索引、在我的 mvn 命令中添加“-U”......但无济于事。只有当我完全绕过本地存储库(空的 .m2/settings.xml)并直接从 Central 或 JBoss public 拉取时,我才能构建我的项目。有没有人知道这里可能发生了什么错误?
更新:
可能有帮助的更多细节:
在我的settingx.xml(如下)中定义为镜像的存储库“nexus”是一个组存储库,包括(按此顺序):
* 中环 ( http://repo1.maven.org/maven2/ )
* JBoss 公开 (http://repository.jboss.org/nexus/content/groups/public/)
* 我们自己上传的本地 jar 的 repo ...
按照@Steve 的建议,我比丢失的drools-compiler 文件更深入地挖掘,发现 org.jboss.dashboard-builder.dashboard-builder-bom... 在 Central 中不存在,有趣的是,但它确实存在于 JBoss 中。我的理解是,通过使用 Repos 组,如果它没有找到任何东西,它应该查询列表中的下一个 repo,对吗?任何建议都非常感谢!
设置.xml:
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>(local server)/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
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>com.mypackage.here</groupId>
<artifactId>TaskLaunchManager</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>TaskLaunchManager</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<app.name>task-launch-manager</app.name>
<log4j.version>1.2.16</log4j.version>
<junit.version>4.8.1</junit.version>
<drools.version>6.2.0.CR4</drools.version>
<slf4j.version>1.7.9</slf4j.version>
</properties>
<!-- Drools Maven BOM (Bill of Materials) -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-bom</artifactId>
<type>pom</type>
<version>${drools.version}</version>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-bom</artifactId>
<type>pom</type>
<version>${drools.version}</version>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!-- Required dependencies -->
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-internal</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-decisiontables</artifactId>
</dependency>
</dependencies>
</project>
最佳答案
好的,问题解决了!它采取了几个步骤,其中一些在 stackoverflow 的其他地方提到并且已经尝试过失败,但是这里的顺序真的很重要:
mvn clean install -U
关于maven - 本地 Nexus 存储库通过 POM 依赖提取除主 jar 之外的所有内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28287761/