-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
maven: running before immutables generates source code #5143
Comments
I think I've fixed this by adding the <profile>
<id>checkerframework</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<fork>true</fork> <!-- Must fork or else JVM arguments are ignored. -->
<compilerArguments>
<Xmaxerrs>10000</Xmaxerrs>
<Xmaxwarns>10000</Xmaxwarns>
</compilerArguments>
<annotationProcessorPaths>
<path>
<groupId>org.checkerframework</groupId>
<artifactId>checker</artifactId>
<version>3.22.0</version>
</path>
</annotationProcessorPaths>
<annotationProcessors>
<!-- ***** THIS IS THE MAGIC ****** -->
<annotationProcessor>org.immutables.value.internal.$processor$.$Processor
<!-- Add all the checkers you want to enable here -->
</annotationProcessor>
<annotationProcessor>org.checkerframework.checker.nullness.NullnessChecker
</annotationProcessor>
</annotationProcessors>
<compilerArgs>
<!-- <arg>-Awarns</arg> --> <!-- -Awarns turns type-checking errors into warnings. -->
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker</artifactId>
<version>3.22.0</version>
</dependency>
</dependencies>
</profile> I'm at the "throw random XML lines until the errors go away" so I'll leave this open in the hope somebody confirms/upgrades these instructions. |
@yatesco I think the issue here is likely that the immutables processor normally runs using "auto-discovery", where just placing it in the processor path causes it to run by default. Auto-discovery gets disabled if you add any explicit https://checkerframework.org/manual/#checker-auto-discovery Let us know if that makes sense / solves your problem. |
Thanks @msridhar - yes, this worked - thank you. Closing. |
Hi - this is more a maven question, but googling has failed me. How do I ensure that the
checkerframework
runs after other things in maven that generate source code?I am using immutables.org which generates source code into
target\generated-sources
. The generated source code is referenced in the test code. However, after adding in the three maven profiles the immutables logic is no longer run which causes the code not to compile.If I comment out the three build profiles then
mvn clean package
works. If I leave the three build profiles in thenmvn clean package
fails because it can't find the generated source code andtarget\generated-sources
is empty.I've tried adding the
org.immutables
dependency in the checkerframework's profile'sannotationProcessorPaths
but that still didn't generate the source code.Do you have any pointers I could chase here? Thanks!
The text was updated successfully, but these errors were encountered: