GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||
GeezerVison is showing github.com — [MPOM-453] Disable annotation processing by compiler by slawekjaranowski · Pull Request #157 · apache/maven-parent Conversation
|
There was an error while loading. Please reload this page.
|
This can be a problem, as no way to override this later (only in java 20? "full"?) @bmarwell will tell 😄 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
We use |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
With a grain of salt... I'd rather define |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think it is best practice to only enable annotation processors by their fully qualified class name. This is possible by setting https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#annotationProcessors. This should IMHO take precedence (but I haven’t checked) over proc being none. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I need more tests ... like possibility to override |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
We could introduce a property, eg I think the way to go is to introduce a new default lifecycle in the compiler plugin in both the compile and test compile Mojos. This means running a new execution I do this in all of my projects like this. However, not sure how incremental works with this proposal. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Works for me as of now. Maybe we can look into a project using an annotation processor to make use of the two phases I mentioned and see what we get from it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but would appreciate some comment in the code for the property
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
0ad1425 to
434d558
Compare
| <!-- in order to restore default annotation processing behaviour, please override with empty value --> | ||
| <maven.compiler.proc>none</maven.compiler.proc> |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Is there a trick to this 'override with empty value' instruction? I tried this general approach after seeing it described here, but haven't been able to get it to work. Using Maven 3.9.4 and compiler-plugin 3.13.0, when I try this I simply get: error: invalid flag: -proc:
Setting the maven.compiler.proc property in the parent disables implicit annotation processing as desired. Setting it again to empty (<maven.compiler.proc></maven.compiler.proc>) in a child pom to override that disabling does alter the property, however it then just causes an error from the compiler seemingly because it is simple being passed -proc bare which it doesnt accept, resulting in the error: invalid flag: -proc:
What am I missing?
(It works if I use "full" instead of empty for the child pom property override, but just as was discussed on this PR and the related one, I dont want to use "full" because of its reliance on recent JDK builds for the backported support of that value)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Empty values don't work unfortunately due to https://github.com/eclipse-sisu/sisu.plexus/issues/29.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'm a little confused given it was you that had asked for the comment about empty override to be added hehe.
So it seems like the comment is really just wrong, and this approach of setting maven.compiler.proc to "none" in a parent is actually unworkable if you dont want to then have to set "full" as the property override value, and require everyone having updated JDKs < 21 with support for that value backported.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We have configuration like:
<properties>
<maven.compiler.proc>none</maven.compiler.proc>
</properties>
....
<configuration>
<proc>${maven.compiler.proc}</proc>
</configuration>
is such case we can set empty value for property in child - it will work
such configuration in child
<configuration>
<proc/>
</configuration>
will not work
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
please try
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
That is one of a few variants I tried before asking (so is your example that wont work), and I believe is precisely what I was doing at the point when I commented earlier. I had also tried before that with just setting the property in the parent+child (i.e not explicitly configuring <proc> with its value), but had noticed you were using the value indirectly to set <proc> rather than just the property itself so I did then try that too.
I tried that version again now per your note to be sure, and it again netted only the error: invalid flag: -proc: failure.
Given it has been part of your parent pom for months, do you know if there is an actual instance of this in use somewhere in the maven project as example?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
ups ...
% git diff
diff --git a/pom.xml b/pom.xml
index e5e60d9..2072a86 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,6 +68,7 @@
<mavenVersion>3.6.3</mavenVersion>
<resolverVersion>1.4.1</resolverVersion>
<project.build.outputTimestamp>2024-06-02T15:17:10Z</project.build.outputTimestamp>
+ <maven.compiler.proc />
</properties>
mvn -V clean compile
Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256)
ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project maven-help-plugin: Fatal error compiling: error: invalid flag: -proc: -> [Help 1]
mvn -V clean compile
Apache Maven 4.0.0-beta-3 (e92f645c2749eb2a4f5a8843cf01e7441e4b559f)
[INFO] BUILD SUCCESS
by default I use Maven 4 ....
so comment is wrong 😖
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Unfortunate. Will likely just need to avoid maven.compiler.proc=none for any projects that do want to do some annotation processing, as its likely to be some time before requiring Maven 4 is viable for some of them.
I did think of an ugly alternative that seems like it may actually work: defining annotationProcessorPaths in the parent pom with a path that doesnt have any annotation processor, thus stopping it finding any unless annotationProcessorPaths is updated. Then use annotationProcessorPaths definitions with combine.children="append" (or perhaps combine.self="override" when sure there are no other potential processors...in my case there are) to add all the actual processor paths when/where needed. Stops implicit search of all the deps, and stops the warnings on JDK21/22.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Resolve #316 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.