Closed chrisie closed 11 years ago
Check if you have two different rhino dependencies in the classpath. The latest 1.7.0 release of wro4j comes with a custom rhino dependencies (built from latest snapshot), but has a different groupId. This can cause two different versions of rhino being present in the classpath.
Thanks for your answer Alexo. I'm guessing you mean the Eclipse classpath, not the project classpath, right? How can I see that?
CTRL+SHIFT+T (search for "EcmaError" class in classpath)
The search for EcmaError returns one matching class in package sun.org.mozilla.javascript.internal - [jdk1.7.0_10].
Then you don't have the required rhino dependency which is added transitively by wro4j-extensions module (this class is part of that dependency: org.mozilla.javascript.EcmaError).
Are you sure you haven't excluded dependencies explicitly?
No, I haven't excluded anything. I also checked for EcmaError on the MacBook of a colleague where wro4j executes without any problems and I also see there only the sun.org.mozilla.javascript.internal.EcmaError class.
When running the plugin from command line using mvn wro4j:run
everything works fine?
Yes, the problem is only when Eclipse attempts to run wro4j when building the project itself (not through Maven).
You could try adding the rhino dependency explicitly... not sure if this would make a difference...
How would I do that? The truth is I'm not too optimistic either since it works on another machine with the same dependencies...
Christie, can you setup a sample project (in a github repo for instance) that fails in eclipse and runs in CLI?
I created a sample project here (https://github.com/chrisie/m2e-wro4j-sample). It is in fact an empty project with just a less file which is processed by wro4j to be compiles to css. It runs with Maven (mvn install or just mvn wro4j:run) either in the command line or through Eclipse (Run as Maven build) but when I modify and save the less file in which case Eclipse kicks in and attempts to build it itself it fails with the above error.
I ended up re-installing Eclipse and all my plugins from scratch which seems to have resolved the problem (for the time being at least). If however at any point you come across this problem again and you figure out what might have caused it and how it can be solved without re-installing Eclipse I'd be really interested in knowing.
I would expect eclipse to use the same dependencies as the maven plugin does. Probably this problem is very hard to reproduce, since it does matter what distribution of eclipse you are using and what plugins are installed.
Actually, to make matters even worse I think that even the order the plugins are installed might make a difference since I installed the same Eclipse distribution and the same plugins I had installed before, only this time I installed wro4j first to make sure it was working.
I have a maven project with the following wro4j configuration in my pom.xml:
The project builds fine with Maven, however I get the following error in Eclipse:
which results in wro4j not being executed when Eclipse builds the project on save. I assume that the problem is somehow related with my environment or configuration since the same project works fine on a colleague's computer but I can't seem to find what's wrong. I am using Windows 7 64-bit with Eclipse Juno SR2 and 1.7.0_10