Skip to content
This repository has been archived by the owner on Jul 30, 2021. It is now read-only.

apt-maven-plugin with maven-release-plugin fails (NPE) #43

Open
guersel opened this issue Jul 17, 2015 · 5 comments
Open

apt-maven-plugin with maven-release-plugin fails (NPE) #43

guersel opened this issue Jul 17, 2015 · 5 comments

Comments

@guersel
Copy link

guersel commented Jul 17, 2015

If I use the apt-maven-plugin in combination with the maven-release-plugin then a NullpointerException will be thrown:

[INFO] [INFO] --- apt-maven-plugin:1.1.3:process (default) @ [myProject]---
[INFO] An exception has occurred in the compiler (1.8.0-internal). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.
[INFO] java.lang.NullPointerException
[INFO]  at com.sun.tools.javac.processing.JavacProcessingEnvironment$ComputeAnnotationSet.scan(JavacProcessingEnvironment.java:797)
[INFO]  at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.findAnnotationsPresent(JavacProcessingEnvironment.java:993)
[INFO]  at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.<init>(JavacProcessingEnvironment.java:927)
[INFO]  at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.next(JavacProcessingEnvironment.java:933)
[INFO]  at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1199)
[INFO]  at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1182)
[INFO]  at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:868)
[INFO]  at com.sun.tools.javac.main.Main.compile(Main.java:535)
[INFO]  at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:141)
[INFO]  at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:150)

This happens if I try to release on jenkins with Java 8 (IBM SDK 64bit). A normal build without trying to release is successful. I use version 1.1.3 of the apt-maven-plugin and version 2.5.1 of the maven-release-plugin, configuration of the apt-maven-plugin looks like:

    <plugin>
            <groupId>com.mysema.maven</groupId>
                <artifactId>apt-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/generated-sources/java</outputDirectory>
                            <processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
                        </configuration>
                    </execution>
                </executions>
    </plugin>

The release build is successful if I debug remotely via Eclipse, maybe there is a timing issue between the release- and apt-plugin?

@Shredder121
Copy link
Member

Could you setup a minimalistic project that we can also debug?
I don't use eclipse, but we'll see if it is also reproducible via other means.

@guersel
Copy link
Author

guersel commented Jul 17, 2015

Thank you for the very fast response.
Unfortunately I am not able to setup a minimalistic projects which fails in the same way. It seems that this issue is project specific.

@guersel
Copy link
Author

guersel commented Jul 22, 2015

I solved the issue by just waiting a few seconds before executing the apt-maven-plugin. Obviously the release plugin creates threads which are in access conflict with the apt-maven-plugin. Maybe someone has another explanation.

@ddebrunner
Copy link

FYI - I'm seeing the same stack trace in a non-maven project. In my case it seems to be related to annotation processing generating a source file with annotations (e.g. @javax.annotation.Generated).

I was also seeing it intermittently, indicating there is some timing issue.

A simple case outside of our source code did not reproduce the issue.

@Shredder121
Copy link
Member

I think that (as @guersel also thought) the release plugin uses a fork of the build reactor to do some logic, and therfore it theoretically could cause timing issues. (this explains the intermittent problems)
I'll look into it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants