maven当中的help插件可以给我们很多的关于当前项目配置的信息
这个goal主要目的让我们了解当前项目最终合并后的配置信息,比如,所有的maven项目都会继承super pom,这时候项目的配置都会继承super pom的配置以及覆盖某些配置.
jiangjian@DESKTOP-0IKNJOE MINGW64 /g/maven-practice/simple-weather
$ mvn help:effective-pom
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.jiangjian:simple-weather:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 73, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 80, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building simple-weather 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-help-plugin:2.2:effective-pom (default-cli) @ simple-weather ---
[INFO]
Effective POMs, after inheritance, interpolation, and profiles are applied:
4.0.0
com.jiangjian
simple-weather
1.0-SNAPSHOT
...省略
该goal主要用来列举当前项目的所有profile以及它们定义的位置(pom.xml, profiles.xml, ~/m2.settings.xml, ${M2_HOME}/conf/settings.xml)
该goal显示当前pom.xml最终的配置信息,下面是对应的功能说明:
Description: Displays the calculated settings as XML for this project,
given any profile enhancement and the inheritance of the global settings
into the user-level settings.
这个goal的目的主要是用来对maven 的插件功能进行查询,比如我们我们需要对help插件提供的功能进行查阅,可以执行如下命令:
mvn help:describe -Dplugin=help
运行结果如下:
Name: Apache Maven Help Plugin
Description: The Maven Help plugin provides goals aimed at helping to make
sense out of the build environment. It includes the ability to view the
effective POM and settings files, after inheritance and active profiles have
been applied, as well as a describe a particular plugin goal to give usage
information.
Group Id: org.apache.maven.plugins
Artifact Id: maven-help-plugin
Version: 3.1.0
Goal Prefix: help
This plugin has 8 goals:
help:active-profiles
Description: Displays a list of the profiles which are currently active for
this build.
help:all-profiles
Description: Displays a list of available profiles under the current
project.
Note: it will list all profiles for a project. If a profile comes up with a
status inactive then there might be a need to set profile activation
switches/property.
help:describe
Description: Displays a list of the attributes for a Maven Plugin and/or
goals (aka Mojo - Maven plain Old Java Object).
help:effective-pom
Description: Displays the effective POM as an XML for this build, with the
active profiles factored in, or a specified artifact.
help:effective-settings
Description: Displays the calculated settings as XML for this project,
given any profile enhancement and the inheritance of the global settings
into the user-level settings.
help:evaluate
Description: Evaluates Maven expressions given by the user in an
interactive mode.
help:help
Description: Display help information on maven-help-plugin.
Call mvn help:help -Ddetail=true -Dgoal= to display parameter
details.
help:system
Description: Displays a list of the platform details like system properties
and environment variables.
For more information, run 'mvn help:describe [...] -Ddetail'
后面的提示大家还可以看到追加 -Ddetail
显示的信息更加的完全,
该命令用来显示系统的配置信息(包括system properties 和 enviroment properties)
mvn help:system
output:
[INFO] --- maven-help-plugin:2.2:system (default-cli) @ welfare-platform ---
[INFO]
===============================================================================
========================= Platform Properties Details =========================
===============================================================================
===============================================================================
System Properties
===============================================================================
java.runtime.name=Java(TM) SE Runtime Environment
sun.boot.library.path=D:\java\jdk8\jre\bin
java.vm.version=25.121-b13
...此处省略
===============================================================================
Environment Variables
===============================================================================
CLASSWORLDS_JAR="D:\apache-maven-3.3.9\bin\..\boot\plexus-classworlds-2.5.2.jar"
PSMODULEPATH=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
PROGRAMW6432=C:\Program Files
COMMONPROGRAMW6432=C:\Program Files\Common Files
MOZ_PLUGIN_PATH=D:\Foxit Reader\plugins\
WINDOWS_TRACING_LOGFILE=C:\BVTBin\Tests\installpackage\csilogfile.log
...此处省略