简体   繁体   中英

What do the configuration lines at verbose output of Maven represent?

Here is an excerpt from the output of mvn -X install :

[DEBUG] Configuring mojo org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-resources-plugin:2.4.3, parent: sun.misc.Launcher$AppClassLoader@33909752]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources' with basic configurator -->
[DEBUG]   (f) buildFilters = []
[DEBUG]   (f) encoding = UTF-8
[DEBUG]   (f) escapeWindowsPaths = true
[DEBUG]   (s) includeEmptyDirs = false
[DEBUG]   (s) outputDirectory = C:\Users\Username\Software\glassfish4\docs\javaee-tutorial\examples\jaxws\helloservice-war\target\classes
[DEBUG]   (s) overwrite = false
[DEBUG]   (f) project = MavenProject: org.glassfish.javaeetutorial:helloservice-war:7.0.5 @ C:\Users\Username\Software\glassfish4\docs\javaee-tutorial\examples\jaxws\helloservice-war\pom.xml
[DEBUG]   (s) resources = [Resource {targetPath: null, filtering: false, FileSet {directory: C:\Users\Username\Software\glassfish4\docs\javaee-tutorial\examples\jaxws\helloservice-war\src\main\resources, PatternSet [includes: {}, excludes: {}]}}]
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@27d4a09
[DEBUG]   (f) useBuildFilters = true
[DEBUG]   (s) useDefaultDelimiters = true
[DEBUG] -- end configuration --

This is the documentation page for the resources goal of my version of the resources plugin.

I would like to know what do these lines (the lines that start with (f) or (s) ) represent. Initially I thought that these represent the parameters of the goal in mention but maven-resources-plugin:2.4.3:resources does not have parameters such as:

  • buildFilters
  • project
  • resources
  • session

So in short:

  1. What do these lines represent?
  2. What does (f) or (s) at the beginning of them represent?

This logs shows how Maven is configuring the plugin for its execution and outputs the value set to each parameter of the plugin's execution.

Each of

[DEBUG]   (f) buildFilters = []
[DEBUG]   (f) encoding = UTF-8
[DEBUG]   (f) escapeWindowsPaths = true
[DEBUG]   (s) includeEmptyDirs = false
[DEBUG]   (s) outputDirectory = C:\Users\Username\Software\glassfish4\docs\javaee-tutorial\examples\jaxws\helloservice-war\target\classes
[DEBUG]   (s) overwrite = false
[DEBUG]   (f) project = MavenProject: org.glassfish.javaeetutorial:helloservice-war:7.0.5 @ C:\Users\Username\Software\glassfish4\docs\javaee-tutorial\examples\jaxws\helloservice-war\pom.xml
[DEBUG]   (s) resources = [Resource {targetPath: null, filtering: false, FileSet {directory: C:\Users\Username\Software\glassfish4\docs\javaee-tutorial\examples\jaxws\helloservice-war\src\main\resources, PatternSet [includes: {}, excludes: {}]}}]
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@27d4a09
[DEBUG]   (f) useBuildFilters = true
[DEBUG]   (s) useDefaultDelimiters = true

corresponds to a property of the maven-resources-plugin . However, not all of them can be configured directly by the user. The ones listed in the documentation corresponds to attributes that can be overriden by the user.

Those that cannot be configured by the user have a special readonly attribute set to true in the MOJO configuration, that you can find in the Mojo API :

Specifies that this parameter cannot be configured directly by the user (as in the case of POM-specified configuration). This is useful when you want to force the user to use common POM elements rather than plugin configurations, as in the case where you want to use the artifact's final name as a parameter.

Those parameters are not shown in the public documentation probably because they are internal parameters that can't be overriden.

For example, if you take a look at the source code for buildFilters :

@Parameter( defaultValue = "${project.build.filters}", readonly = true )
protected List<String> buildFilters;

you can notice that this attribute is in fact a parameter of the plugin, but it is set as readonly. The same goes for project or session .

The meaning of (s) and (f) is more obscure to me, you can see them in the source code and it apparently represents whether the parameter was set by Maven using a setter (s) or reflection (f) .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM