Community
Participate
Working Groups
Build Identifier: Although Maven compiler API does contain configuration for using APT during compilation, Tycho JDT implementation does not use any. Activating it is rather simple, as the compiler does support it. Reproducible: Always Steps to Reproduce: 1. Configure the compiler to use an annotation processor <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.6</source> <target>1.6</target> <fork>false</fork> <compilerId>jdt</compilerId> <annotationProcessors> <annotationProcessor>com.acme.apt.AnnotationProcessor</annotationProcessor> </annotationProcessors> </configuration> <dependencies> <dependency> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-compiler-jdt</artifactId> <version>0.14.0-SNAPSHOT</version> </dependency> <!-- dependency containing the annotation processor specified in the annotationProcessor element --> <dependency> <groupId>com.acme.apt</groupId> <artifactId>com.acme.apt.super-processor</artifactId> <version>1.0.0-SNAPSHOT</version> </dependency> </dependencies> </plugin> 2. Launch the compile phase on a project whose sources contains annotations that should be processed by your processor. 3. Annotation processing is not triggered.
Created attachment 204872 [details] Eclipse JDT APT jar As the org.eclipse.jdt.core-3.8.0.v_C03.jar does not contain APT-related classes, this one should also be used in the compiler project dependencies
Created attachment 204873 [details] Patch that enabled annotation processing for tycho-jdt-compiler
Initially filled under https://issues.sonatype.org/browse/TYCHO-590
Created attachment 207924 [details] reworked patch to apply to HEAD patch did not apply to HEAD anymore. Questions/Remarks: - it seems this patch mixes fixes for unrelated issues such as error parsing and compiler option defaults. I would like to keep these out of this bug (we can open other bugs for these) - The test project currently fails for me and a test class which builds the test project was missing - the patch only covers the usecase of using the JDT compiler in the context of packaging type "jar". The important case of packaging type "eclipse-plugin" is not covered (and we will need more modifications to the tycho copy of AbstractCompilerMojo to make this work... which brings back the question if we really want to maintain a fork of AbstractCompilerMojo :( - note to committers: we will need to file CQs for new versions of plexus-compiler-api and plexus-compiler-manager (plus potentially respective dependencies)
(In reply to comment #4) > > - the patch only covers the usecase of using the JDT compiler in the context of > packaging type "jar". The important case of packaging type "eclipse-plugin" is > not covered (and we will need more modifications to the tycho copy of I think APT support for eclipse-plugin is a separate usecase. > AbstractCompilerMojo to make this work... which brings back the question if we > really want to maintain a fork of AbstractCompilerMojo :( > We never *wanted* to maintain a fork of AbstractCompilerMojo, so the real question is -- what it takes to get rid of the fork and who is going to do the work? Another, related question, does PDE support APT inside workspace?
(In reply to comment #5) > Another, related question, does PDE support APT inside workspace? It looks like there is generic support for APT from JDT which can also be added to a PDE workspace project (see screenshot). This will add a generated source folder and create a .settings/org.eclipse.jdt.apt.core.prefs. From the PDE headless build, looks like it can be supported via custom callbacks.
Created attachment 207960 [details] APT project properties - screenshot
(In reply to comment #4) > Created attachment 207924 [details] > reworked patch to apply to HEAD > > patch did not apply to HEAD anymore. > > Questions/Remarks: > > - it seems this patch mixes fixes for unrelated issues such as error parsing > and compiler option defaults. I would like to keep these out of this bug (we > can open other bugs for these) > OK, I'll open separate issues for these concerns. > - The test project currently fails for me and a test class which builds the > test project was missing Test might be failing because of a mismatch in properties. In the org.eclipse.tycho.tychoits.TYCHO590 pom, the declared property 'tycho.version' should probably just be changed into tycho-version. I you still get the issue, just send the result. > - the patch only covers the usecase of using the JDT compiler in the context of > packaging type "jar". The important case of packaging type "eclipse-plugin" is > not covered (and we will need more modifications to the tycho copy of > AbstractCompilerMojo to make this work... which brings back the question if we > really want to maintain a fork of AbstractCompilerMojo :( > > - note to committers: we will need to file CQs for new versions of > plexus-compiler-api and plexus-compiler-manager (plus potentially respective > dependencies) Thanks anyway for reworking the patch to be usable with the current HEAD and some project-specific features I didn't see.
Created attachment 207994 [details] test failure log
(In reply to comment #9) tycho.version was just a leftover from the original patch, it's not used anymore. How to reproduce? - git clone http://git.eclipse.org/gitroot/tycho/org.eclipse.tycho.git - apply patch using 'git am' - build tycho using 'mvn clean install' - run test using 'cd tycho-its; mvn clean test -Dtest=AnnotationProcessorTest'
(In reply to comment #10) In am only able to reproduce the error if I remove the JDT apt JAR (org.eclipse.tycho:org.eclipse.jdt.core:jar:apt:3.8.0.v_C03) from the tycho-compiler-jdt module. Eclipse compiler system will just skip annotation processing if classes aren't present in the classpath, without producing any errors. I APT is triggered, you should see these lines in the non-debug Maven output, during compiler execution: [APT] Source file already created : tycho590.processed.Processor 1. WARNING: No SupportedSourceVersion annotation found on tycho590.JSR269Processor, returning RELEASE_6. 1 problem (1 warning) But seeing your test log, the JDT apt JAR does seem to be in the classpath for compilation. Is it possible that you used a different JAR than the one attached to this issue?
(In reply to comment #11) > But seeing your test log, the JDT apt JAR does seem to be in the classpath for > compilation. Is it possible that you used a different JAR than the one attached > to this issue? d'oh. I used the wrong bundle org.eclipse.jdt.apt.core_3.3.500.v20110420-1015.jar should be the fragment org.eclipse.jdt.compiler.apt instead. now it works :)
Created attachment 208008 [details] patch with copyright headers added added copyright headers to patch and opened CQ 5867 for it
1. Did you author 100% of the content you are contributing Yes 2. Do you have the rights to donate the content to Eclipse Yes 3. Are you contributing the content under the EPL Yes You will receive soon an e-mail validating the donation from BSB.
created CQ 5898, 5899 for plexus-compiler-api 1.8.1 and plexus-compiler-manager 1.8.1
Hi Jan, hi Thomas! When is the patched version expected to be released? We're in desperate need of getting APT/Tycho/Maven up and running. This bug is a real showstopper for us at the moment. The last possible resort would be calling the eclipse batch compiler using an ant task from maven. We didn't expected the combination APT/Maven/Eclipse to be such a pain :-( There are several serious open issues for the apt compiler in in javac (at least for Java 1.6), therefore we have to go the ecj way for automated builds, too. This patch be would really great :-) Kind regards Benjamin
(In reply to comment #16) > When is the patched version expected to be released? I will try to get this into 0.14.0. However this depends on the pending IP review of the used libraries plexus-compiler-api, plexus-compiler-manager 1.8.1 and I don't have influence on the priorities of the eclipse IP team.
Adding Wayne on CC. CQs 5898, 5899 are waiting for PMC approval. Anything we still need to do about these CQs?
Hi, if I guess right, according to the bug described here https://bugs.eclipse.org/bugs/show_bug.cgi?id=360628 there won't be any nightly builds available for Tycho in the near future? In the version to which this bug here (360427) is left/set to unspecified. Does this mean that this patch won't be included in 0.14.0? In this case, this would be a pitty, especially because the patch looks very promising :-( Kind regards Benjamin
(In reply to comment #19) > Hi, > > if I guess right, according to the bug described > here https://bugs.eclipse.org/bugs/show_bug.cgi?id=360628 > there won't be any nightly builds available for Tycho in > the near future? sure we have SNAPSHOT builds. They are available from https://oss.sonatype.org/content/groups/public/ This patch did not make it into 0.14.0 simply because IP review for the dependent new libraries used by the patch (CQs 5898, 5899) is still pending. Other than that the patch is fine. I can't check in source code without IP review.
CQs approved
*** Bug 375592 has been marked as a duplicate of this bug. ***
https://git.eclipse.org/r/#/c/5579/
http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/commit/?id=8597822cca31717dd2b173695c4922a0435ae469