Hi Marcello,
I'm not at a computer where I can try this out. What jumps out at me is:
* define an additional sourceset that has the same src dir of src/main/
java, except with an include for the domain path, something like:
sourceSets { jpa { srcDir "src/main/java" ; includes ... } }
* configure the jpaCompile task to pass the jvm arguments you need,
something like: jpaCompile { jvmarg '-processor' ; .... }
* add a configuration as a home for the CtfExtensionProcessor
dependencies: configurations { ctf }
* add it's dependencies dependencies { ctf 'org.hibernate:hibernate-
annotations:3.3.1.GA' ; .... }
* supply the dependencies to the jpaCompile task, something like:
jpaCompile { classpath += configurations.ctf.asPath ; ... }
Hopefully that will see you on the right track.
Cheers,
Merlyn
On Jul 23, 2011, at 4:22 PM, marcellodesales wrote:
Hi Marlyn,
Taking your question literally you'll need to pass your compile
classpath
to ant.javac.
Wouldn't there be any magical Maven dependency way to do that? I
could use
the user's .m2 cache path, but I wanted gradle/maven to take care of
it for
me... :)
I'd like to lead you in a different direction, though, as it would
be far
cleaner to have Gradle itself
compile your source. I'm assuming that anything in your domain
package
needs to be compiled
using this CtfExtensionProcessor.
In a way, yes... The only thing the compiler will do is to compile
+analyze
domain classes and look for the ones annotated with @Entity (JPA)...
That
will result in the generation of other java source code, which will
NOT be
compiled them at that time... Only code generation...
What about the remaining source files? Do they require the output of
CtfExtensionProcessor before
they can be compiled?
This step is a just one of my "initial passes" before the full
source-code
is compiled altogether... So, yes, the remaining (whole other
components)
depend on the source code generated by the processor in order to get a
successful compilation... The only problem at the moment is that we
have a
highly customized "compile" task on the imported build.xml that I
can't
change at the moment (but I will push a complete migration to Gradle
in a
near future :D)...
I started off just doing "cmd".execute() and it worked without a
problem,
but since there are dozens of classes to be analyzed, I need to get
the list
of classes and the dependency taken care of using Gradle (in case new
dependencies or changes occur)...
Thanks Merlyn... Please share any solution you can think of... It
took me
the entire night and this morning and I can't find anything :(
Marcello
--
View this message in context:
http://gradle.1045684.n5.nabble.com/Javac-Java-Annotation-Processor-Maven-classpath-dependencies-in-Gradle-tp4626751p4627001.html
Sent from the gradle-user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email