Maven:Maven属性值概述 [英] Maven: Overview for the values of Maven properties

查看:127
本文介绍了Maven:Maven属性值概述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找出所有 Maven属性的值,因为它们适用于某些Maven项目.
mvn help:system列出了OS环境变量和JVM系统属性,但没有Maven属性.
mvn help:evaluate仅在交互模式下有效,这意味着我必须键入单个Maven属性(例如${project.build.outputDirectory})才能获取该属性的值.

I would like to find out the values of all Maven properties as they apply to some Maven project.
mvn help:system lists OS environment variables and JVM system properties, but no Maven properties.
mvn help:evaluate only works in an interactive mode, that means I have to type a single Maven property, (e.g. ${project.build.outputDirectory}) to get the value of that property.

我正在寻找一种获取所有Maven属性及其值的完整列表的方法.

I'm looking for a way get a full list of all Maven properties and their values.

推荐答案

作为解决方法,请将其添加到项目pom.xml中的<plugins> ... </plugins>部分:

As a workaround, add this to the <plugins> ... </plugins> section inside your project's pom.xml:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-antrun-plugin</artifactId>
  <version>1.7</version>
  <executions>
    <execution>
      <phase>validate</phase>
      <goals>
        <goal>run</goal>
      </goals>
      <configuration>
        <tasks>
          <echoproperties />
        </tasks>
      </configuration>
    </execution>
  </executions>
</plugin>

现在执行mvn validate.
在带有[echoproperties]前缀的控制台上,将有完整的系统属性列表,包括由Maven设置的那些属性,例如project.build.outputDirectorybasedirsettings.localRepository.

Now execute mvn validate.
On the console, prefixed with [echoproperties], there will be the full list of system properties, including those set by Maven such as project.build.outputDirectory, basedir, and settings.localRepository.

这篇关于Maven:Maven属性值概述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆