Jimdo / gradle-apt-plugin

A Gradle plugin for the Java annotation processor tool
Apache License 2.0
47 stars 10 forks source link

Handle all JavaCompile tasks #11

Open ypoluektovich opened 10 years ago

ypoluektovich commented 10 years ago

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:

ypoluektovich commented 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.

futtetennista commented 10 years ago

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.

confile commented 9 years ago

@ypoluektovich Could you please provide an example how I can use APT on tasks of type JavaCompile?

confile commented 9 years ago

@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
ypoluektovich commented 9 years ago

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.