简体   繁体   中英

Drools project has errors in Eclipse, but builds with maven

I'm new to Drools and pretty new to maven. I am trying to incorporate Drools 6.0.1 into a Wildfly (8.0.0) based project. I am using the current version of JBoss Developer Studio 7.1.1.GA on Redhat Linux In Eclipse the project has a number of errors in CDI modules, but builds without errors in maven. The Java auto-complete works correctly as I import annotations, but after is is imported I get an error in the file showing

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.Dependent;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.InjectionPoint;

The above all show the same type of error:

Only a type can be imported. javax.enterprise.inject.Disposes resolves to a package

It seems to be limited to the javax cdi includes

This is a maven project, and maven compiles it with no problems. Only Eclipse seems to have an issue.

I have m2eclipse installed as well.

In addition, if I use Java 7 syntax extensions it complains about those too. The maven pom specifies Java 1.7, the project facets specifies 1.7 and the default compliance level is also Java 1.7. But something somewhere doesn't like it. Again, a maven build works. Only Eclipse has problems. I suspect the Eclipse Drools plugin may be at fault as I don't see this in non-Drools projects

I see this in the standard Java files, not the .drl files. It is quite annoying and frustrating.

I found that this can be easily reproduced. You need m2eclipse installed, and the drools 6.0.1.Final plugin installed 1. In Eclipse create a new drools project 2. Convert the project to maven 3. add the javax.enterprise:cdi-api (version 1.1) dependency 3. Maven>Update Project 4. edit a java file in the project and try to add one of the above listed imports and you will see the same error.

This was a bug in the Drools plugin. It seems to be fixed in the 6.1CR version. The fix is available here: http://download.jboss.org/drools/release/6.1.0.CR2/org.drools.updatesite/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM