我们刚开始使用Drools 6,并且正在尝试使用内部Nexus存储库中的Rules Artifacts。
当工件存在于本地存储库中时,一切正常。
但是,在尝试从存储库中检索工件时,我们会遇到以下异常:
WARN MavenRepository - Unable to resolve artifact: foo.bar.rules.callflow.res:rules-callflow-res:1.0.0-SNAPSHOT
org.sonatype.aether.resolution.ArtifactResolutionException: Could not transfer artifact foo.bar.rules.callflow.res:rules-callflow-res:jar:1.0.0-SNAPSHOT from/to nexus (http://nexus:8081/nexus/content/groups/public): No connector available to access repository nexus (http://nexus:8081/nexus/content/groups/public) of type using the available factories FileRepositoryConnectorFactory, WagonRepositoryConnectorFactory
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:286)
at org.kie.scanner.MavenRepository.resolveArtifact(MavenRepository.java:205)
at org.kie.scanner.MavenRepository.resolveArtifact(MavenRepository.java:194)
at org.kie.scanner.ArtifactResolver.resolveArtifact(ArtifactResolver.java:51)
at org.kie.scanner.KieRepositoryScannerImpl.loadArtifact(KieRepositoryScannerImpl.java:100)
at org.kie.scanner.KieRepositoryScannerImpl.loadArtifact(KieRepositoryScannerImpl.java:93)
at org.drools.compiler.kie.builder.impl.KieRepositoryImpl.loadKieModuleFromMavenRepo(KieRepositoryImpl.java:114)
at org.drools.compiler.kie.builder.impl.KieRepositoryImpl.getKieModule(KieRepositoryImpl.java:100)
at org.drools.compiler.kie.builder.impl.KieRepositoryImpl.getKieModule(KieRepositoryImpl.java:77)
at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:97)
at foo.bar.rules.callflow.res.CallflowRESTests.test0800800800(CallflowRESTests.java:36)
这是我们的测试类:
public class CallflowRESTests
{
private KieServices ks;
private KieContainer kContainer;
@Before
public void setup() {
ks = KieServices.Factory.get();
}
@Test
public void test0800800800() {
try
{
ReleaseId releaseId = ks.newReleaseId("foo.bar.rules.callflow.res","rules-callflow-res","1.0.0-SNAPSHOT");
KieContainer kContainer = ks.newKieContainer(releaseId);
// Extra code removed since problem occurs in the line above
} catch (Exception e)
{
e.printStackTrace();
}
}
}
工件存在于我们的内部Nexus存储库中,但是当我运行测试类时,它从不尝试连接到它(使用Wireshark检查)。
我在这里错过了哪一部分?
答案 0 :(得分:0)
经过数小时的调查后,我似乎发现了导致我们无法从远程Maven存储库中检索规则工件的问题。 根本原因是Maven配置中settings.xml中的一个部分。删除此部分后,我们的规则实现能够从远程Nexus存储库中检索规则工件。 但是,似乎在尝试连接到我们配置的存储库之前(在settings.xml中)它尝试联系外部IP地址,但这似乎是一个maven问题而不是规则问题。
编辑27.03.2015:使用Drools 6.1.0.Final在Maven settings.xml中使用时,你必须添加行
<layout>default</layout>
到镜像配置。 之后它应该有效。