Enable annotation processing
See original GitHub issueHi, I’m trying to use https://github.com/immutables/immutables which is an annotation based source code generator.
In the docs (https://immutables.github.io/apt.html), it’s mentioned that the m2e-apt Eclipse plugin needs to be configured when building in Eclipse, so presumably this is why in vscode it doesn’t work?
I was previously having problems with Rocker templates, and with hindsight this might have been related.
Environment
- Operating System: xubuntu yakkety
- JDK version: 1.8.0_131-b11
- Visual Studio Code version: 1.17.1
- Java extension version: 0.12.0
- Maven 3.5
- Maven compiler plugin 3.6
Steps To Reproduce
https://immutables.github.io/getstarted.html
- Set up a Maven project that includes the
org.immutablesdependency - Add a test class that uses the
@Value.Immutableannotation - vs-code-java fails to generate the source code, but a mvn compile will
Current Result
No generated source code for @Value.Immutable annotated class
Expected Result
Corresponding Immutable... class source code generated
Additional Informations
I tried adding org.jboss.tools.maven.apt.core_1.3.0.201610261805 to the extension’s server/plugins folder to see if that allowed the annotation processor to be picked up, but it wasn’t effective. I also tried putting the Immutables jar in the annotationProcessorPaths element in the maven compile plugin configuration, but it still wasn’t picked up.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:20 (5 by maintainers)
Top Related StackOverflow Question
Is Gradle supported as well? Having the following in
build.gradle, I keep getting “[Java] AutoValue_Remark cannot be resolved to a type” errors in my project.(Version 0.28.0)
@simon04 I found a simple workaround for using Gradle with the annotationProcessor features (Immutables, AutoValue, Metamodels).
The idea is to add manually the location of the generated sources. In my case, I just had to add
build/generated/source/apt/maintosrcDirs:I don’t know if it is a good idea or whatever, but it works and helps me get the job done 😁