Open ypoluektovich opened 10 years ago
In fact, I thought about it some more, and made the second commit which gets rid of project.afterEvaluate completely for Java projects. Now the configuration application task is available to the user in the project build script too.
My own tests (on my project) show that it works fine.
Thanks very much for the PR! I'm a little busy atm, but I'll make sure I'll have a proper look at this asap.
@ypoluektovich Could you please provide an example how I can use APT on tasks of type JavaCompile?
@ypoluektovich I get the following error when I try to use your modification:
* What went wrong:
A problem occurred evaluating root project 'apt'.
> org/apache/commons/lang/StringUtils
Example 1: https://github.com/ypoluektovich/msyu-logging/blob/master/example/build.gradle Line 3 is for where I keep my build of this PR, line 4 is to make commons-lang available on APT classpath (you can also use mavenCentral() or your corporate proxying maven repo), line 7 adds the plugin itself, line 11 applies, line 18 adds an annotation processor.
Example 2: https://github.com/ypoluektovich/msyu-logging/blob/master/runtime/build.gradle Same as above, only this time we need the annotation processor for tests, not for production files. See line 26.
This patch adds more sophisticated handling for Java projects, enabling one to use APT not only in 'compileJava' tasks, but all tasks of type 'JavaCompile'.
Important notes: