checker framework causing maven build exception

34 views
Skip to first unread message

Siddharth Jain

unread,
Jan 18, 2024, 1:14:58 PMJan 18
to Checker Framework discussion
I am trying to use the checker framework with a maven project. here is my complete config:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<jdkToolchain>
<version>21</version>
</jdkToolchain>
<fork>true</fork>
<annotationProcessorPaths>
<path>
<groupId>org.checkerframework</groupId>
<artifactId>checker</artifactId>
<version>3.42.0</version>
</path>
</annotationProcessorPaths>
<annotationProcessors>
<annotationProcessor>org.checkerframework.checker.nullness.NullnessChecker</annotationProcessor>
</annotationProcessors>
<compilerArgs combine.children="append">
<arg>-Xmaxerrs</arg>
<arg>10000</arg>
<arg>-Xmaxwarns</arg>
<arg>10000</arg>
<arg>-Awarns</arg>
<arg>--enable-preview</arg>
<arg>--add-modules</arg>
<arg>jdk.incubator.vector</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
</compilerArgs>
<parameters>true</parameters>
</configuration>
</plugin>
but it gives me this error when i try to compile my project. I initially thought the problem was with maven and it was treating javac warnings to use incubator modules 

[WARNING] using incubating module(s): jdk.incubator.vector


[WARNING] using incubating module(s): jdk.incubator.vector


[WARNING] using incubating module(s): jdk.incubator.vector
as error 

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project xxx-utils: Compilation failure: Compilation failure:


[ERROR] using incubating module(s): jdk.incubator.vector


[ERROR] using incubating module(s): jdk.incubator.vector


[ERROR] using incubating module(s): jdk.incubator.vector
but if I remove following lines from the config:
<annotationProcessorPaths>
<path>
<groupId>org.checkerframework</groupId>
<artifactId>checker</artifactId>
<version>3.42.0</version>
</path>
</annotationProcessorPaths>
<annotationProcessors>
<annotationProcessor>org.checkerframework.checker.nullness.NullnessChecker</annotationProcessor>
</annotationProcessors>
the build passes, so the problem is with the checker framework. can anyone tell me what is happening here and how to fix this? thanks.

Suzanne Millstein

unread,
Jan 18, 2024, 1:36:16 PMJan 18
to Siddharth Jain, Checker Framework discussion
I copied your plugin block into a Maven project and I was able to
compile successfully. (I get the "[WARNING] using incubating
module(s): jdk.incubator.vector" but no "[ERROR] using incubating
module(s): jdk.incubator.vector".) Can you provide the complete Maven
build file and source code so we can reproduce this?
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "Checker Framework discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to checker-framework-...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/checker-framework-discuss/282812ca-1f5d-482b-a313-6088ec06e385n%40googlegroups.com.

Siddharth Jain

unread,
Jan 18, 2024, 2:55:35 PMJan 18
to Checker Framework discussion

Siddharth Jain

unread,
Jan 18, 2024, 2:55:35 PMJan 18
to Checker Framework discussion
below is the effective pom. there is nothing new in it:
<plugin>

        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.11.0</version>
        <executions>
          <execution>
            <id>default-compile</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>

            <configuration>
              <jdkToolchain>
                <version>21</version>
              </jdkToolchain>
              <fork>true</fork>
            </configuration>
          </execution>
          <execution>
            <id>default-testCompile</id>
            <phase>test-compile</phase>
            <goals>
              <goal>testCompile</goal>
            </goals>

            <configuration>
              <jdkToolchain>
                <version>21</version>
              </jdkToolchain>
              <fork>true</fork>
            </configuration>
          </execution>
        </executions>

        <configuration>
          <jdkToolchain>
            <version>21</version>
          </jdkToolchain>
          <fork>true</fork>
        </configuration>
      </plugin>
not possible for me to provide source code.

On Thursday, January 18, 2024 at 10:36:16 AM UTC-8 smi...@cs.washington.edu wrote:

Suzanne Millstein

unread,
Jan 18, 2024, 3:04:31 PMJan 18
to Siddharth Jain, Checker Framework discussion
I can successfully use
<arg>--enable-preview</arg>
<arg>--add-modules</arg>
<arg>jdk.incubator.vector</arg>
With the Checker Framework, so I would guess that it is a problem with
something else where in the pom file. Without being able to reproduce
this locally, we can't help. If you can make a small Maven example
that reproduces this problem and can share it, we can try that.
> To view this discussion on the web visit https://groups.google.com/d/msgid/checker-framework-discuss/9a95918f-ae1c-4864-96ad-1d994c625af5n%40googlegroups.com.

Michael Ernst

unread,
Jan 18, 2024, 3:26:30 PMJan 18
to Checker Framework discussion
I'm sorry you are having trouble.

For bug reporting, please don't use this mailing list.  Instead, use the issue tracker:
https://github.com/typetools/checker-framework/issues
The manual makes this clear:
https://checkerframework.org/manual/#reporting-bugs

We would like to help you, but you have not provided enough information to let us do that.  The situation is:

 * Lots of people use the Checker Framework with Maven.
 * It does not work for you.
 * You provided a snippet of Maven configuration, which we confirmed works properly in a sample project.  Since it does not work for you, apparently your Maven configuration is doing something complex.  Maybe the problem is with the Checker Framework, but maybe not; it is premature to blame the Checker Framework.
 * You are asking us to debug some complex Maven configuration which you are not sharing with us.

We can't help you unless you provide a full reproducible example.  Please create the simplest possible Maven configuration that reproduces the example, and that permits us to reproduce the problem by running `mvn compile`.  Thanks!

                    -Mike

Siddharth Jain

unread,
Jan 18, 2024, 4:26:09 PMJan 18
to Checker Framework discussion
I fixed it. the problem was at my end. I hadn't added the dependency (step 1 here). I did not add it because I wasn't using anything from the checker framework in the source code (I wanted to do a test drive first) but I guess the framework still requires it to be added - whether you use it or not. But what all this means is that this bug is still not fixed in maven with version 3.11.0 as there is no output in the console of the actual error [1]. And without the fix its really difficult to debug actual issue:
Debugging your Maven configuration can be tricky because of a bug in maven-compiler-plugin versions before 3.10.1: Maven does not report annotation processor exceptions, even when the -X command-line argument is passed. 

Michael Ernst

unread,
Jan 18, 2024, 4:27:50 PMJan 18
to Checker Framework discussion
Excellent!  I am glad it is working for you.
(I agree that Maven is a pain...)

-Mike

Reply all
Reply to author
Forward
0 new messages