[GRADLE-2246] Cannot build with reportng Created: 20/Apr/12  Updated: 04/Jan/13  Resolved: 09/May/12

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-9
Fix Version/s: None

Type: Bug
Reporter: Lidia Marchioni Assignee: Unassigned
Resolution: Not A Bug Votes: 0

Attachments: File build.gradle     File demo.out     File g.out     Text File g.out.exception.txt     Zip Archive testreportng.zip    

 Description   

Adding reportng dependency causes the following error:

Could not resolve all dependencies for configuration ':compile'.
> Artifact 'org.testng:testng:6.3.1:jdk15@jar' not found.

The dependency is declared as:

dependencies

{ compile "org.seleniumhq.selenium:selenium-java:2.15.0" compile "org.testng:testng:6.3.1" compile "org.uncommons:reportng:1.1.2" }

If I change the declaration to the following:

dependencies {
compile "org.seleniumhq.selenium:selenium-java:2.15.0"
compile "org.testng:testng:6.3.1"
compile ("org.uncommons:reportng:1.1.2")

{ exclude group: "org.testng", module: "testng" }

}

I get the following exception:

  • Exception is:
    org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'console-bg1'.
    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)

(...)

Caused by: java.lang.StackOverflowError
at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:804)
at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:1096)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1049)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:128)
at org.gradle.api.tasks.testing.testng.TestNGOptions.methodMissing(TestNGOptions.groovy:204)

Full exception attached. Have not found a solution nor a workaround to this issue.



 Comments   
Comment by Szczepan Faber [ 30/Apr/12 ]

Both:

dependencies {
  compile "org.seleniumhq.selenium:selenium-java:2.15.0"
  compile "org.testng:testng:6.3.1"
  compile ("org.uncommons:reportng:1.1.2") { exclude group: "org.testng", module: "testng" }
}

and:

dependencies {
  compile "org.seleniumhq.selenium:selenium-java:2.15.0"
  compile "org.testng:testng:6.3.1"
  compile ("org.uncommons:reportng:1.1.2")
}

worked fine for me when I did gradle dependencies with 1.0-rc-3. Can you try to reproduce with 1.0-rc-3, please?

Comment by Lidia Marchioni [ 01/May/12 ]

Upgrading to 1.0-rc-3 resolved the reportng dependency issue when using the exclude group clause. I'm still seeing the same issue without it though:

  • What went wrong:
    Could not resolve all dependencies for configuration ':compile'.
    > Artifact 'org.testng:testng:6.3.1:jdk15@jar' not found.

Lidia

Comment by Lidia Marchioni [ 01/May/12 ]

Unfortunately, even though I can now run the tests with the dependencies, once I add reportng listeners to build.gradle, I get a StackOverflowException:

  • What went wrong:
    A problem occurred evaluating root project 'console-bg1'.
    > java.lang.StackOverflowError (no error message)

more details:

Caused by: java.lang.StackOverflowError
at org.gradle.api.tasks.testing.testng.TestNGOptions.methodMissing(TestN
GOptions.groovy:204)
at org.gradle.api.tasks.testing.testng.TestNGOptions.methodMissing(TestN
GOptions.groovy:204)

My listeners are defined as:

        options {
            listeners << 'org.uncommons.reportng.HTMLReporter'
            listeners << 'org.uncommons.reportng.JUnitXMLReporter'
        }

I'll attach gradle.build and full output under g.out.exception.txt.

Comment by Lidia Marchioni [ 01/May/12 ]

Attaching build file.

Comment by Lidia Marchioni [ 01/May/12 ]

Attaching output with exception (execution with --stacktrace option).

Comment by Lidia Marchioni [ 08/May/12 ]

Created a simple test in TestNG alone (no Selenium) and got it working with the following:
task demo(type: Test)

{ useTestNG() }

Then added the reportng listeners, as in:

task demo(type: Test) {
useTestNG()
options

{ listeners << 'org.uncommons.reportng.HTMLReporter' listeners << 'org.uncommons.reportng.JUnitXMLReporter' useDefaultListeners = false }

}

and the build failed with:

Execution for Test process 'Gradle Worker 1' FAILED
org.gradle.api.internal.tasks.testing.TestSuiteExecutionException: Could not com
plete execution for test process 'Gradle Worker 1'.
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(Su
iteTestClassProcessor.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
(...)
Caused by: java.lang.NoClassDefFoundError: com/google/inject/Module
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.privateGetPublicMethods(Class.java:2547)
at java.lang.Class.getMethods(Class.java:1410)
(...)
at org.apache.velocity.app.Velocity.mergeTemplate(Velocity.java:449)
at org.uncommons.reportng.AbstractReporter.generateFile(AbstractReporter
.java:102)
at org.uncommons.reportng.HTMLReporter.createOverview(HTMLReporter.java:
141)
at org.uncommons.reportng.HTMLReporter.generateReport(HTMLReporter.java:
106)
at org.testng.TestNG.generateReports(TestNG.java:1032)
at org.testng.TestNG.run(TestNG.java:991)
at org.gradle.api.internal.tasks.testing.testng.TestNGTestClassProcessor
.stop(TestNGTestClassProcessor.java:103)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(Su
iteTestClassProcessor.java:58)
... 31 more
Caused by: java.lang.ClassNotFoundException: com.google.inject.Module
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 66 more

While this is a different error than before, I still cannot get reportng working with gradle.

Comment by Lidia Marchioni [ 08/May/12 ]

Simple TestNG test that fails to run with reportng listeners enabled.

Comment by Lidia Marchioni [ 08/May/12 ]

Output of the TestNG only run with ReportNG listeners (NoClassDefFoundError: com/google/inject/Module).

Comment by Lidia Marchioni [ 08/May/12 ]

OK, so I found that I needed to add guice as a dependency - with this both projects work fine:

compile group: 'com.google.inject', name: 'guice', version: '3.0'

Comment by Lidia Marchioni [ 08/May/12 ]

I cannot close this issue.

Comment by Szczepan Faber [ 09/May/12 ]

I'm glad you managed to resolve the problem!

Closing...

Generated at Wed Jun 30 12:16:41 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.