-
Notifications
You must be signed in to change notification settings - Fork 182
Annotation processor not always detected when using <type>processor</type>
#987
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
Conversation
| ## Removed JUnit tests | ||
| Removed the following directories and associated test methods: | ||
|
|
||
| * `compiler-one-output-file-test2` because it was redundant with `compiler-one-output-file-test`. | ||
|
|
||
| The only difference was the addition of include/exclude filters, but that difference had | ||
| no effect because the compiler mock used in this test was ignoring all sources anyway. | ||
| This test has been replaced by `compiler-modular-project`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think no one will care in the future about this. This is appropriate for this PR / issue to mention once, but for future use it is probably uninteresting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of this file is to document the differences between the 3.x and 4.0 branches. The compiler-one-output-file-test2 directory is still present in the 3.x branch. Because some tests have been added in the 3.x branch without being ported yet to the 4.0 branch (e.g., MCOMPILER-538), in the future we may want to compare the two branches for checking which tests present in one branch are missing in the other branch. This note is for remembering to not port that directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I thought that should be obvious when browsing through the history, as the history would now have a reference to an issue. But now that you mention it, your commits do not have an issue linked, it seems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'm lazily mixing two works in this same pull request. The work that really solves the issue described in this issue is the "Fix: annotation processor not always detected when specified with processor" commit. But since this commit adds a new integration test, this pull request opportunistically does some cleanup in those tests first. Those cleanups are in separated commits, with the intend to not squash them. The README.md file is added as part of this cleanup, but it describes changes that were actually done long ago.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'm lazily mixing two works in this same pull request.
then why all those renames :D :D :D 💋
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is because some integration tests were using the install goal. I replaced some install by verify in this commit but a few remain if I remember right. The use of install goal in integration tests pollutes the ~/.m2/repository/ directory. By using the org.apache.maven.plugins.compiler.it groupId for all tests, we ensure that if some install goals are used again for whatever reason, at least we have a single place to cleanup in the .m2/repository directory.
src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
Show resolved
Hide resolved
src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
Outdated
Show resolved
Hide resolved
...t/processor-type/annotation-processor/src/main/java/processor/SimpleAnnotationProcessor.java
Outdated
Show resolved
Hide resolved
| ## Removed JUnit tests | ||
| Removed the following directories and associated test methods: | ||
|
|
||
| * `compiler-one-output-file-test2` because it was redundant with `compiler-one-output-file-test`. | ||
|
|
||
| The only difference was the addition of include/exclude filters, but that difference had | ||
| no effect because the compiler mock used in this test was ignoring all sources anyway. | ||
| This test has been replaced by `compiler-modular-project`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'm lazily mixing two works in this same pull request.
then why all those renames :D :D :D 💋
src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
Outdated
Show resolved
Hide resolved
…n all integration tests.
5397de6 to
78c9f4c
Compare
…ype>processor</type>`. Replace some relatively verbose "is null or empty" checks by `isAbsent(…)` methods.
…undError`. It may happen when an annotation processor is present but has a dependency which is missing.
78c9f4c to
cb9fd8d
Compare
In Maven 4, the recommended way to add a JAR on the annotation processor classpath is like below:
However, Maven Compiler Plugin 4.0.0-beta-3 does not automatically detects the processor if it is declared only as above. This commit fixes that issue and adds an integration test, together with opportunistic cleaning in other integration tests.
In the main time, as a workaround, adding the following configuration seems to work, where
org.foo.MyAnnotationProcessoris the value declared in theMETA-INF/services/javax.annotation.processing.Processorfile. Note that only the processor class is declared, not the artifact coordinates: