无法使用KIE-CI为Drools运行基本示例,隐藏在依赖项错误中

时间:2014-07-03 12:08:11

标签: drools

以下示例:2.1.5. KieModules, KieContainer and KIE-CI。 尝试执行以下操作,编码并从我的本地仓库中检索快照。快照是众所周知的drools示例包。

   public static void main(String[] args) {

        KieServices ks = KieServices.Factory.get();
        KieContainer kContainer = ks.newKieContainer(

        ks.newReleaseId("org.drools", "default-kiesession", "6.2.0-SNAPSHOT") );

    }

当我试图运行以下简单的代码时,我被埋没在嵌套的依赖项exeptions中,逐个解析我看不到隧道尽头的光。正如您在下面的pom中看到的,依赖项列表无休止地增长,并且对于3行代码来说是巨大的,每当我尝试运行我的示例时,我会越来越多地遇到类错误...

        org.kie         纪伊慈         6.2.0-SNAPSHOT     

<dependency>
    <groupId>org.kie</groupId>
    <artifactId>kie-api</artifactId>
    <version>6.2.0-SNAPSHOT</version>
</dependency>

<dependency>
    <groupId>org.kie</groupId>
    <artifactId>kie-internal</artifactId>
    <version>6.2.0-SNAPSHOT</version>
</dependency>


<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <version>1.7.7</version>

</dependency>
<dependency>
    <groupId>org.drools</groupId>
    <artifactId>drools-core</artifactId>
    <version>6.2.0-SNAPSHOT</version>
</dependency>
<dependency>
    <groupId>org.drools</groupId>
    <artifactId>drools-compiler</artifactId>
    <version>6.2.0-SNAPSHOT</version>
</dependency>

<dependency>
    <groupId>org.sonatype.aether</groupId>
    <artifactId>aether-api</artifactId>
    <version>1.13.1</version>
</dependency>

<dependency>
    <groupId>org.sonatype.aether</groupId>
    <artifactId>aether-util</artifactId>
    <version>1.13.1</version>
</dependency>

<dependency>
    <groupId>org.apache.maven</groupId>
    <artifactId>maven-plugin-api</artifactId>
    <version>3.2.2</version>
</dependency>
<dependency>
    <groupId>org.apache.maven</groupId>
    <artifactId>maven-model</artifactId>
    <version>3.2.2</version>
</dependency>
<dependency>
    <groupId>org.apache.maven</groupId>
    <artifactId>maven-core</artifactId>
    <version>3.2.2</version>
</dependency>

<dependency>
    <groupId>org.apache.maven</groupId>
    <artifactId>maven-aether-provider</artifactId>
    <version>3.0.5</version>
</dependency>

<dependency>
    <groupId>args4j</groupId>
    <artifactId>args4j-tools</artifactId>
    <version>2.0.23</version>
</dependency>
<!--<dependency>-->
    <!--<groupId>org.apache.maven</groupId>-->
    <!--<artifactId>maven-aether-provider</artifactId>-->
    <!--<version>3.0.5</version>-->
<!--</dependency>-->

<!--<dependency>-->
    <!--<groupId>org.apache.maven</groupId>-->
    <!--<artifactId>maven-settings-builder</artifactId>-->
    <!--<version>3.2.1</version>-->
<!--</dependency>-->

我花了3个小时才达到了突破点,目前的结果是:

[main] WARN org.kie.scanner.embedder.MavenSettings - Environment variable M2_HOME is not set
[main] WARN Sisu - Error injecting: org.apache.maven.execution.DefaultMavenExecutionRequestPopulator
com.google.inject.ProvisionException: Guice provision errors:

1) No implementation for org.apache.maven.repository.RepositorySystem was bound.
  while locating org.apache.maven.execution.DefaultMavenExecutionRequestPopulator

1 error
    at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:974)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1000)
    at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:84)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:52)
    at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100)
    at org.eclipse.sisu.plexus.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:133)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:108)
    at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55)
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1018)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:59)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
    at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:965)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1011)
    at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:961)
    at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:82)
    at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:260)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:252)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:246)
    at org.kie.scanner.embedder.MavenEmbedder.lookup(MavenEmbedder.java:492)
    at org.kie.scanner.embedder.MavenEmbedder.buildMavenExecutionRequest(MavenEmbedder.java:136)
    at org.kie.scanner.embedder.MavenEmbedder.<init>(MavenEmbedder.java:99)
    at org.kie.scanner.embedder.MavenEmbedder.<init>(MavenEmbedder.java:88)
    at org.kie.scanner.embedder.MavenEmbedder.<init>(MavenEmbedder.java:115)
    at org.kie.scanner.embedder.MavenProjectLoader.parseMavenPom(MavenProjectLoader.java:23)
    at org.kie.scanner.embedder.MavenProjectLoader.loadMavenProject(MavenProjectLoader.java:54)
    at org.kie.scanner.Aether.<init>(Aether.java:45)
    at org.kie.scanner.Aether.getAether(Aether.java:55)
    at org.kie.scanner.MavenRepository.getMavenRepository(MavenRepository.java:73)
    at org.kie.scanner.ArtifactResolver.<init>(ArtifactResolver.java:36)
    at org.kie.scanner.KieRepositoryScannerImpl.getArtifactResolver(KieRepositoryScannerImpl.java:87)
    at org.kie.scanner.KieRepositoryScannerImpl.loadArtifact(KieRepositoryScannerImpl.java:97)
    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 test.main(test.java:13)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
[main] WARN org.kie.api.builder.KieScanner - Unable to parse pom.xml file of the running project: org.kie.scanner.embedder.MavenEmbedderException: com.google.inject.ProvisionException: Guice provision errors:

1) No implementation for org.apache.maven.repository.RepositorySystem was bound.
  while locating org.apache.maven.execution.DefaultMavenExecutionRequestPopulator
  at ClassRealm[maven, parent: ClassRealm[maven-parent, parent: null]]
  at ClassRealm[maven, parent: ClassRealm[maven-parent, parent: null]]
  while locating org.apache.maven.execution.MavenExecutionRequestPopulator

1 error
      role: org.apache.maven.execution.MavenExecutionRequestPopulator
  roleHint: 
Exception in thread "main" java.lang.NoClassDefFoundError: org/sonatype/aether/connector/file/FileRepositoryConnectorFactory
    at org.kie.scanner.Aether.newRepositorySystem(Aether.java:87)
    at org.kie.scanner.Aether.<init>(Aether.java:63)
    at org.kie.scanner.Aether.<init>(Aether.java:45)
    at org.kie.scanner.Aether.getAether(Aether.java:55)
    at org.kie.scanner.MavenRepository.getMavenRepository(MavenRepository.java:73)
    at org.kie.scanner.ArtifactResolver.<init>(ArtifactResolver.java:36)
    at org.kie.scanner.KieRepositoryScannerImpl.getArtifactResolver(KieRepositoryScannerImpl.java:87)
    at org.kie.scanner.KieRepositoryScannerImpl.loadArtifact(KieRepositoryScannerImpl.java:97)
    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 test.main(test.java:13)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.ClassNotFoundException: org.sonatype.aether.connector.file.FileRepositoryConnectorFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 19 more

Process finished with exit code 1

我无法理解为什么这么简单的例子必须如此艰难地运行。

0 个答案:

没有答案