Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6156

Grapes/@Grab does not work with JDK8

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.1.3
    • Fix Version/s: 2.1.8
    • Component/s: None
    • Labels:
      None

      Description

      Groovy appears not to be able to run TestNG tests. The code:

      @Grab('org.testng:testng:6.8.5')
      @Grab('org.codehaus.groovy:groovy-testng:2.2.0-SNAPSHOT')
      import org.testng.annotations.Test
      import static org.testng.Assert.assertEquals
      
      class testngFails {
        @Test void calculateTheResult() {
          assertEquals('Hello World.', 'Hello World.')
        }
      }
      

      when executed results in the output:

      Caught: org.testng.TestNGException:
      An error occurred while instantiating class testngFails: null
      org.testng.TestNGException:
      An error occurred while instantiating class testngFails: null
      at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:398)
      at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:299)
      at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:110)
      at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:186)
      at org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:120)
      at org.testng.TestRunner.initMethods(TestRunner.java:409)
      at org.testng.TestRunner.init(TestRunner.java:235)
      at org.testng.TestRunner.init(TestRunner.java:205)
      at org.testng.TestRunner.<init>(TestRunner.java:153)
      at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:522)
      at org.testng.SuiteRunner.init(SuiteRunner.java:157)
      at org.testng.SuiteRunner.<init>(SuiteRunner.java:111)
      at org.testng.TestNG.createSuiteRunner(TestNG.java:1273)
      at org.testng.TestNG.createSuiteRunners(TestNG.java:1260)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:1114)
      at org.testng.TestNG.run(TestNG.java:1031)
      Caused by: java.lang.ExceptionInInitializerError
      at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:29)
      at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:387)
      ... 15 more
      Caused by: java.lang.RuntimeException: No suitable ClassLoader found for grab
      at testngFails.<clinit>(testngFails.groovy)
      ... 17 more

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                melix Cédric Champeau
                Reporter:
                russel Russel Winder
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: