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

@Grapes does not work (at least not in Groovy Console)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.5
    • 1.6.6, 1.7-rc-1
    • Grape
    • None
    • Mac OS 10.6.1
      Java 1.6.0_15

    Description

      Try this in Groovy Console:

      @Grapes(
        [@Grab(group='org.spockframework', module='spock-core', version='0.2'),
        @Grab(group="junit", module="junit", version="4.7")])
      class HelloSpock extends Specification {
       def "can you figure out what I'm up to?"() {
         expect:
         name.size() == length
      
         where:
         name << ["Kirk", "Spock", "Scotty"]
         length << [4, 5, 6]
       }
      }
      

      Output:

      1 compilation error:
      
      unable to resolve class Specification 
       at line: 1, column: 1
      

      This means that Spock is not on the compile class path. When I @Grab JUnit and Spock individually by introducing a fake class, script works as expected. (Well, not quite. I need to add JUnitCore.run(HelloSpock) because otherwise, the test class is no longer found.)

      By the way, if Ivy was fully compatible with Maven, the JUnit @Grab wouldn't be necessary, because JUnit is a mandatory compile-time dependency of Spock. Admittedly, Ivy's transitive dependency resolution is more correct than Maven's, but at the cost of breaking compatibility. Is there a way to tweak this?

      Attachments

        1. 3851_v16x.txt
          4 kB
          Roshan Dawrani

        Issue Links

          Activity

            People

              roshandawrani Roshan Dawrani
              pniederw Peter Niederwieser
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: