Maven plugin MOJO API in term of parameters

℡╲_俬逩灬. 提交于 2019-12-24 16:42:26

问题


From my understanding
the MOJO relative to the compile goal of the maven-compiler-plugin
defines its own parameters,just like any other MOJO plugins.

For example it should have a parameter defined somewhat like the following:

/** @parameter default-value="${project.build.sourceDirectory}" */
private String sDir; 

So these parameters definitions represent a kind of API for the MOJO,
that we can set in various way, mainly from the execution tag.

Please,correct me if I'm wrong.

My question is: Where can I filed the API fefinition of the standard maven plugin, in term of those parameters?


回答1:


A MOJO (or be more accurate) a goal of a plugin can define the parameter as it likes (or what the plugin author has in mind). Yes this means it's is a kind of an API which is accessed via the pom.xml via the configuration tag of the plugin or sometimes via command line (in case of special goals).

For every plugin you can find the documentation online like for example for the maven-compiler-plugin where you can find here the appropriate parameters:

https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html

Any of the plugins which are located in the groupId: org.apache.maven.plugins you can find it via this overview:

https://maven.apache.org/plugins/

and you can access the linke goals on the page where you find the list of available goals a plugin has and if you go to the link you will find all the parameters.

Apart from that you should take a look here:

  • https://maven.apache.org/developers/mojo-api-specification.html
  • https://maven.apache.org/plugin-tools/maven-plugin-tools-annotations/index.html

For things which can be used in the defaultValue you can take a look here:

  • https://maven.apache.org/ref/3.1.1/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html


来源:https://stackoverflow.com/questions/36594632/maven-plugin-mojo-api-in-term-of-parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!