native-build-tools
native-build-tools copied to clipboard
Add agent modes to Maven plugin
Similar to #230 for Gradle plugin, we should implement something similar for the Maven plugin:
<configuration>
<agent>
<enabled>true</enabled>
<defaultMode>standard</defaultMode>
<disabledPhases>
<phase>test</phase>
</disabledPhases>
<modes>
<standard>
</standard>
<conditional>
<userCodeFilterPath>path-to-filter.json</userCodeFilterPath>
<extraFilterPath>path-to-another-filter.json</extraFilterPath>
</conditional>
<direct>
<options>
<option>config-output-dir={output_dir}</option>
<option>experimental-configuration-with-origins</option>
</options>
</direct>
</modes>
<commonOptions>
<callerFilterFiles>filter.json</callerFilterFiles>
<accessFilterFiles>filter.json</accessFilterFiles>
<builtinCallerFilter>true</builtinCallerFilter>
<builtinHeuristicFilter>true</builtinHeuristicFilter>
<enableExperimentalPredefinedClasses>false</enableExperimentalPredefinedClasses>
<enableExperimentalUnsafeAllocationTracing>false</enableExperimentalUnsafeAllocationTracing>
<trackReflectionMetadata>true</trackReflectionMetadata>
</commonOptions>
<metadataCopy>
<inputPhases>
<phase>main</phase>
<phase>test</phase>
</inputPhases>
<outputDirectories>
<dir>src/main/resources/META-INF/native-image</dir>
</outputDirectories>
</metadataCopy>
</agent>
</configuration>
Concrete use case that will hopefully be solved by this issue : allowing Spring native agent sample to remove this usage of maven-antrun-plugin
Unrelated : I am quite puzzled by the DevXP people get with everything in red in the IDE :
I think this is related to our usage of a Maven extension to parse the XML.
@lazar-mitrovic Could you please detail why this is needed? I would like to explore if there is a path where at least most common parts of the XML config can discoverable and not in red like that.
The reason why those elements are in red is because the generated META-INF/maven/plugin.xml
has all the descriptions as <description></description>
.
When building a Maven plugin with Maven, those are taken from the Javadoc. In the case of our Gradle-based build, I'm not sure yet what is the missing piece that makes them to be empty.
Sorry, I misread your comment. What I described would cause the existing config elements to not have documentation (eg by pressing F1).
agent
in particular is in red because it's not part of plugin.xml
, as is being read by NativeExtension
as you described.
One possible workaround would be to add agent
and its nested options as @Parameter
s to any mojo (even if unused now). But probably it's not worth it since this task will precisely revamp agent configuration, and by doing so, we would need to add such @Parameter
s
So after the refactoring, will users have proper autocompletion and not anymore everything in red in IDEs?
Yes, as part of this task, agent
and all its structure should be defined as @Parameter
in AbstractNativeMojo
, which will make them be present in plugin.xml
and therefore autocomplete