Details
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
Attachments
Issue Links
- is related to
-
GROOVY-3861 AST transforms of spock do not take effect when the library is loaded using @Grab
- Closed