Integrate Drools with Maven2 is a worry~~

来源:互联网 发布:刷赞软件 编辑:程序博客网 时间:2024/06/03 19:56
Is this Maven 1 or Maven 2? Maven 2

What steps will reproduce the problem?
1. Create a GWT project where mvn install works fine.
2. Add a reference in the POM to Drools dependencies:
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>4.0.4</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>4.0.4</version>
</dependency>
3. mvn install now fails:
Unable to parse module: com.google.gwt.user.User
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult
.getErrors()[Lorg/eclipse/jdt/core/compiler/IProblem;
at
com.google.gwt.dev.jdt.AbstractCompiler$ICompilerRequestorImpl.accept
Result(AbstractCompiler.java:213)
at org.eclipse.jdt.internal.compiler.Compiler.compile
(Compiler.java:417)

at com.google.gwt.dev.jdt.AbstractCompiler$CompilerImpl.compile
(Abstract
Compiler.java:74)
at com.google.gwt.dev.jdt.AbstractCompiler$CompilerImpl.compile
(Abstract
Compiler.java:162)
at com.google.gwt.dev.jdt.AbstractCompiler$CompilerImpl.access$600
(Abstr
actCompiler.java:61)
at com.google.gwt.dev.jdt.AbstractCompiler.compile
(AbstractCompiler.java
:430)
at
com.google.gwt.dev.jdt.AstCompiler.getCompilationUnitDeclarations(Ast
Compiler.java:117)
at com.google.gwt.dev.jdt.TypeOracleBuilder.build
(TypeOracleBuilder.java
:354)
at com.google.gwt.dev.cfg.ModuleDef.getTypeOracle
(ModuleDef.java:294)
at com.google.gwt.dev.GWTCompiler.distill(GWTCompiler.java:321)
at com.google.gwt.dev.GWTCompiler.run(GWTCompiler.java:755)
at com.google.gwt.dev.GWTCompiler.run(GWTCompiler.java:745)
at com.google.gwt.dev.GWTCompiler.main(GWTCompiler.java:213)
Exception in thread "main" java.lang.NoSuchMethodError:
org.eclipse.jdt.internal
.compiler.CompilationResult.getErrors()
[Lorg/eclipse/jdt/core/compiler/IProblem;

at
com.google.gwt.dev.jdt.AbstractCompiler$ICompilerRequestorImpl.accept
Result(AbstractCompiler.java:213)
at org.eclipse.jdt.internal.compiler.Compiler.compile
(Compiler.java:417)

at com.google.gwt.dev.jdt.AbstractCompiler$CompilerImpl.compile
(Abstract
Compiler.java:74)
at com.google.gwt.dev.jdt.AbstractCompiler$CompilerImpl.compile
(Abstract
Compiler.java:162)
at com.google.gwt.dev.jdt.AbstractCompiler$CompilerImpl.access$600
(Abstr
actCompiler.java:61)
at com.google.gwt.dev.jdt.AbstractCompiler.compile
(AbstractCompiler.java
:430)
at
com.google.gwt.dev.jdt.AstCompiler.getCompilationUnitDeclarations(Ast
Compiler.java:117)
at com.google.gwt.dev.jdt.TypeOracleBuilder.build
(TypeOracleBuilder.java
:354)
at com.google.gwt.dev.cfg.ModuleDef.getTypeOracle
(ModuleDef.java:294)
at com.google.gwt.dev.GWTCompiler.distill(GWTCompiler.java:321)
at com.google.gwt.dev.GWTCompiler.run(GWTCompiler.java:755)
at com.google.gwt.dev.GWTCompiler.run(GWTCompiler.java:745)
at com.google.gwt.dev.GWTCompiler.main(GWTCompiler.java:213)

What is the expected output? What do you see instead?
I expect the build to still execute correctly.
Instead I see an error report and the build fails.

What version of the product are you using? On what operating system?
<artifactId>maven-googlewebtoolkit2-plugin</artifactId>
<version>2.0-beta6</version>
GWT 1.4.61, on Windows Vista.

Please provide any additional information below.

[INFO] --------------------------------------------------------------------
----
[ERROR] BUILD ERROR
[INFO] --------------------------------------------------------------------
----
[INFO] Exception attempting compile.

Embedded error: Compilation failed.
[INFO] --------------------------------------------------------------------
----
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Exception
attempting compile.
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
(DefaultLifecycleExecutor.java:564)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycl
e(DefaultLifecycleExecutor.java:480)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
(DefaultLifecycleExecutor.java:459)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFai
lures(DefaultLifecycleExecutor.java:311)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments
(DefaultLifecycleExecutor.java:278)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute
(DefaultLifecycleExecutor.java:143)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced
(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode
(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Exception
attempting compile.
at com.totsp.mavenplugin.gwt.CompileMojo.execute
(CompileMojo.java:58)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo
(DefaultPluginManager.java:443)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
(DefaultLifecycleExecutor.java:539)
... 16 more
Caused by: org.apache.maven.plugin.MojoFailureException: Compilation
failed.
at com.totsp.mavenplugin.gwt.CompileMojo.execute
(CompileMojo.java:55)
... 18 more


Comment 1 by kebernet, Jan 31, 2008
Can you not set drools-compiler <scope>runtime</scope>?
Comment 2 by skingaby, Feb 04, 2008
I was able to work around this by excluding the JDT from the Drools components:

<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>4.0.4</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.jdt</groupId>
<artifactId>core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>4.0.4</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.jdt</groupId>
<artifactId>core</artifactId>
</exclusion>
</exclusions>
</dependency>
Comment 3 by mirko.nasato, Aug 07, 2008
That's because gwt-dev.jar includes the org.eclipse.jdt classes, so you ended up with
two different versions of JDT in your classpath.

Ideally gwt-dev.jar should be repackaged to only include com.google.gwt classes, and
declares other dependencies in its pom.xml like any good Maven citizen.
Comment 4 by charlie.collins, Sep 09, 2008
I added the workaround to the M2 FAQ - we aren't going to repackage GWT (the
workaround seems sufficient)
 
原创粉丝点击