HTML reporter error in Java /Scala mixed project and maven profiles

539 views
Skip to first unread message

gerrald...@gmail.com

unread,
Mar 25, 2014, 8:08:28 AM3/25/14
to scalate...@googlegroups.com
Hi!
We have a web service developed in Java with Maven and we need to integrate ScalaTest of this service.
With the use of scala-maven-plugin(3.1.5) and scalatest-maven-plugin (1.0-M4-SNAPSHOT) it compiles and runs scalatests.
 
But when I add htmlreporters in scalatest-maven-plugin  the following error occures:
 
[INFO] --- scalatest-maven-plugin:1.0-M4-SNAPSHOT:test (default-cli) @ my-service ---
An exception or error caused a run to abort. This may have been caused by a problematic custom reporter.
java.lang.IncompatibleClassChangeError: class org.objectweb.asm.tree.ClassNode has interface org.objectweb.asm.ClassVisi
tor as super class
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
       
>> I've attached the full stacktrace
 
HTML reporter in pom :
<dependency>
                    <groupId>org.pegdown</groupId>
                    <artifactId>pegdown</artifactId>
                    <version>1.4.2</version>
                    <scope>test</scope>
                </dependency>
 
Can anybody help to fix this?
 
html reporter error.txt

Bill Venners

unread,
Mar 25, 2014, 10:30:36 AM3/25/14
to scalate...@googlegroups.com
Hi Gerrald,

I believe you're simply missing a transitive dependency that's needed when you use the HTML Reporter. THe HTML Reporter uses pegdown, which uses asm. I believe all you should have to do in Maven is add a dependency on pegdown. Here's what it is for the latest ScalaTest release:


<dependency>
<groupId>org.pegdown</groupId>
<artifactId>pegdown</artifactId>
<version>1.4.2</version>
</dependency>

This is optional in ScalaTest because you only need it if you use the HTML Reporter. I need to figure out how to better document this requirement. Info on all the optional libraries can be gleaned from the pom:

https://oss.sonatype.org/content/groups/public/org/scalatest/scalatest_2.10/2.1.2/scalatest_2.10-2.1.2.pom

Bill


--
You received this message because you are subscribed to the Google
Groups "scalatest-users" group.
To post to this group, send email to scalate...@googlegroups.com
To unsubscribe from this group, send email to
scalatest-use...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/scalatest-users?hl=en
ScalaTest itself, and documentation, is available here:
http://www.artima.com/scalatest
---
You received this message because you are subscribed to the Google Groups "scalatest-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalatest-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Bill Venners
Artima, Inc.
http://www.artima.com

gerrald...@gmail.com

unread,
Mar 25, 2014, 11:26:17 AM3/25/14
to scalate...@googlegroups.com
Bill,
Thanks for snap answer!
 
Unfortunately, even when I add the dependency teh error persists.
 
Here's my build config:
 
<build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.7</version>
                        <configuration>
                            <skipTests>true</skipTests>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.scalatest</groupId>
                        <artifactId>scalatest-maven-plugin</artifactId>
                        <version>1.0-M4-SNAPSHOT</version>
                        <configuration>
                            <reportsDirectory>${project.basedir}/target/test-reports</reportsDirectory>
                            <htmlreporters>${project.basedir}/target/test-reports/html</htmlreporters>
                            <junitxml>.</junitxml>
                            <testFailureIgnore>false</testFailureIgnore>
                            <tagsToInclude>${testtags}</tagsToInclude>
                            <suites>${suites}</suites>
                        </configuration>
                        <executions>
                            <execution>
                                <id>scala-test</id>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>net.alchim31.maven</groupId>
                        <artifactId>scala-maven-plugin</artifactId>
                        <version>3.1.5</version>
                        <executions>
                            <execution>
                                <id>scala-test-compile-first</id>
                                <phase>process-test-resources</phase>
                                <goals>
                                    <goal>testCompile</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <scalaVersion>${scala.version}</scalaVersion>
                            <recompileMode>incremental</recompileMode>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
When remove "  <htmlreporters>${project.basedir}/target/test-reports/html</htmlreporters> "  test run fine.Wut I do like html reports that Scalatest plugin generates and plan to share those.
 
May be there is any other workaround? Could that be something in the project itself (it is written in Java but I do want to use Scalatest for acceptance tests)?
 
Thanks for your efforts!
 
Regards,
GerraldG
 

Bill Venners

unread,
Mar 25, 2014, 11:41:36 AM3/25/14
to scalate...@googlegroups.com

Hi Gerrald,

I just looked again at the pom and we also mention asm, so that must be needed too. I'm now on a phone and don't know how to copy and paste. If you can follow the link I'm my earlier email to the pom and search for asm you should see it.  Try adding that too.

Bill

--

gerrald...@gmail.com

unread,
Mar 25, 2014, 12:59:17 PM3/25/14
to scalate...@googlegroups.com
Bill,
 
I've tried to add asm as dependency and unfotunately that did not solved the error.
Another thing is that if I add scala tests to the project as separate module - eveything works: tests are run, reports are generated.
This error only happens if tests are in the project itself - in src/test/scala and I'm trying to run them as separate Maven profile.
 
I'm currently looking if there are some conflicts - we're using swagger
 
Thanks for help!
 
Regards,
GerraldG
 

Bill Venners

unread,
Mar 25, 2014, 1:16:45 PM3/25/14
to scalate...@googlegroups.com
Hi Gerrald,

OK. Yes that sounds scarily like one thing you using needs a different version of asm, which is a pain to fix if that's the case. There's a tool someone once pointed me to that can list out all your project's dependencies. I can't remember if it was just for sbt, or what it was, but I'd look for such a tool for Maven. Better yet, a tool that finds conflicts. If anyone knows of such a tool or technique, please post it here for present and future reference.

Thanks.

Bill

Bill


--
You received this message because you are subscribed to the Google
Groups "scalatest-users" group.
To post to this group, send email to scalate...@googlegroups.com
To unsubscribe from this group, send email to
scalatest-use...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/scalatest-users?hl=en
ScalaTest itself, and documentation, is available here:
http://www.artima.com/scalatest
---
You received this message because you are subscribed to the Google Groups "scalatest-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalatest-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

gerrald...@gmail.com

unread,
Mar 26, 2014, 3:28:23 AM3/26/14
to scalate...@googlegroups.com
I used mvn dependency:tree and did search for asm.
Turned out that we have cglib and spring-asm both with asm versions 3.1 while pegdown seems to be using asm 4.1
I tried to downgrade pegdown hoping that some earlier versions would use asm 3.1 but seems like pegdown uses asm 4.1 since its 2.1.version. Moreover, seems that pegdown version 1.1 does not use asm at all.
So downgrading to pegdown 1.1 removed the conflict and now reports are generated. So far everything looks fine but we'll see
 
Thanks  for help Bill and for ScalaTests- great tool!
 
Regards,
GerraldG
 
 
Reply all
Reply to author
Forward
0 new messages