如何显示插件版本

时间:2011-04-20 00:40:06

标签: java maven

我想知道安装的插件版本。哪个命令可以做到?

5 个答案:

答案 0 :(得分:19)

mvn -Dplugin=<groupId>:<artifactId> help:describe

插件的详细说明 - 包括版本

答案 1 :(得分:13)

如果你想知道你的构建使用哪个版本的插件(包括通过maven master pom提供的插件),请尝试:

mvn help:effective-pom

答案 2 :(得分:7)

我不知道你的'插件安装的版本'是什么意思,但是Maven help plugin让你通过给出groupId和artifactId来获得插件的描述,

mvn -Dplugin=<groupId>:<artifactId> help:describe

您将获得该插件的详细说明 - 包括版本(虽然我必须承认我不知道版本号解析的策略)。

maven-dependency-plugin的

示例

mvn -Dplugin=org.apache.maven.plugins:maven-dependency-plugin help:describe

<强>输出

Name: Maven Dependency Plugin
Description: Provides utility goals to work with dependencies like copying,
  unpacking, analyzing, resolving and many more.
Group Id: org.apache.maven.plugins
Artifact Id: maven-dependency-plugin
Version: 2.2
Goal Prefix: dependency

This plugin has 21 goals:

dependency:analyze
  Description: Analyzes the dependencies of this project and determines which
    are: used and declared; used and undeclared; unused and declared. This goal
    is intended to be used standalone, thus it always executes the test-compile
    phase - use the dependency:analyze-only goal instead when participating in
    the build lifecycle.

dependency:analyze-dep-mgt
  Description: This mojo looks at the dependencies after final resolution and
    looks for mismatches in your dependencyManagement section. In versions of
    maven prior to 2.0.6, it was possible to inherit versions that didn't match
    your dependencyManagement. See MNG-1577 for more info. This mojo is also
    useful for just detecting projects that override the dependencyManagement
    directly. Set ignoreDirect to false to detect these otherwise normal
    conditions.

dependency:analyze-duplicate
  Description: Analyzes the <dependencies/> and <dependencyManagement/> tags
    in the pom.xml and determines the duplicate declared dependencies.

... and much more

答案 3 :(得分:1)

将其添加到您的pom.xml文件中,您将在mvn clean install上获得结果:

<plugins>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>versions-maven-plugin</artifactId>
    <version>2.1</version>
    <executions>
      <execution>
        <phase>validate</phase>
        <goals>
           <goal>display-dependency-updates</goal>
           <goal>display-plugin-updates</goal>
           <goal>display-property-updates</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
</plugins>

如果你只想做一次:

mvn versions:display-plugin-updates

答案 4 :(得分:0)

打包maven(-X)时,可以添加“ mvn clean compile * -X”参数,然后搜索“ artifactId”以查看确切的版本号。