views:

137

answers:

1

We've just recently converted our project to using Maven for builds and dependency management, and after the conversion I'm getting the following exception while trying to run any JSFUnit tests in my project.

Exception class=[java.lang.UnsupportedOperationException]
com.gargoylesoftware.htmlunit.ScriptException: CSSRule com.steadystate.css.dom.CSSCharsetRuleImpl is not yet supported.
    at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:527)
    at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
    ...

All the dependencies and JARs for JSFUnit were pulled with Maven using the JBoss repository (http://repository.jboss.com/maven2/).

We're using the following dependencies in the project:

  • jboss-jsfunit-core 1.2.0.Final
  • jboss-jsfunit-richfaces 1.2.0.Final
  • richfaces-ui 3.3.2.GA
  • openfaces 2.0
  • JSF 1.2_12
  • Facelets 1.1.14

Before the dependencies were being managed by Maven, we were able to run our JSFUnit tests just fine. I was able to semi-fix the issue by using a ss_css2.jar file that someone had tucked into our WEB-INF/lib directory (from before the Maven conversion). I'm hoping to find out if there's something else I can do to fix the dependencies in Maven rather than resorting to managing some of the dependencies myself.

+2  A: 

You're very likely getting an "incompatible" version of HtmlUnit or another JAR (pulled transitively). Try with the version you were using previously and declare it under the dependencyManagement section, e.g.

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>net.sourceforge.htmlunit</groupId>
      <artifactId>htmlunit</artifactId>
      <version>2.7</version><!-- put "your" version here -->
    </dependency>
  </dependencies>
</dependencyManagement>    

Or, if you changed any version, try to revert to the exact previous state (by the way, could you clarify the differences between the previous versions and the one currently used?).

Update: It appears that the problem was related to the version of the cssparser artifact. I hadn't all the required elements to figure this out but the OP did :)

Pascal Thivent
@brianf There must be a difference somewhere. I don't know if you're aware of the dependency plugin but you can print the dependency tree (including transitive dependencies) with `mvn dependency:tree`. It's very helpful to debug the classpath (also available in m2eclipse under the "dependency hierarchy" tab).
Pascal Thivent
While ensuring all the versions were the same didn't solve my issue, I did try lowering the version on the cssparser depedency to 0.9.4 (was previously 0.9.5) and that seems to have solved my problem.
Brian Feaver