Russel Winder wrote:
Traditionally in Maven and in Gradle, tests were run against the classes dir because passing the test was a precondition for building the jar (jar depends on test). This happens to have just changed in Gradle (over the weekend). Jar no longer depends on test and there is a set of new tasks starting with "build" that will both test and compile.Hopefully this isn't just a RTFM question . . . The classic lifecycle includes: . . . compile the code of the jar (or whatever) to a directory compile the tests against the directory of compiled classes run the tests create the artifact. . .I am increasingly of the view that this way of compiling and running the tests is the wrong way of doing things -- even for unit tests. I think the artifact should be made and the tests compiled and run against that. From what I can see Maven is not able to do this sort of testing. OK there is an integration-test phase but the directory of compiled code is always in the classpath of the test compile and execution, which effectively ruins any idea of running the unit tests with the jar instead of the directory of compiled classes. I am hoping that this restriction has not been bolted into Gradle. So I want to: compile the classes of the jar create the jar compile the tests using the jar and not the directory of compiled classes run the tests using the jar and not the directory of compiled classes. Is there a Gradle idiom/example for doing this? Thanks. BTW Is gradle heading towards Maven's ability to generate websites with all the various reports? That is a very cool feature of Maven.
Test, however, is still running out of the classes dir and not off of the jar. I'm not convinced that this is wrong, but we should allow you the flexibility to change it. The JavaPlugin adds the classes dir to the testCompile configuration (see JavaPlugin.java line 245 in the trunk). The DependencyHandler doesn't have a good way of removing dependencies only adding them. Perhaps you could replace the testCompile configuration with a copy filtered using one of the filtering forms of Configuration.copy. There needs to be a better way of customizing things like this.
-- Steve Appling Automated Logic Research Team --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
