Maven: Overview for the values of Maven properties

后端 未结 5 1866
野性不改
野性不改 2020-12-08 04:31

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

相关标签:
5条回答
  • 2020-12-08 04:51

    I don't know how to get them "officially", but here is a workaround. Add maven-antrun-plugin to your project and run mvn test -X. The plugin will show all properties passed to it from Maven. The list looks complete to me.

    0 讨论(0)
  • 2020-12-08 04:55

    Not sure if helps, but I found this when trying to do the same thing:

    mvn com.github.ekryd.echo-maven-plugin:echo-maven-plugin:echo -Decho.message='${project.build.testOutputDirectory}'
    

    From here

    0 讨论(0)
  • 2020-12-08 05:01

    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>
    

    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.

    0 讨论(0)
  • 2020-12-08 05:04

    Actually project.build.outputDirectory is there but you need to execute in 'compile' phase, and NOT in 'validate'. I guess what properties are available also depends on the current phase for the executing goal of a particular plug-in, in this case 'maven-antrun-plugin'.

                <!-- Ant Run Plugin for debugging pom.xml and calling ant tasks -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>${ant.plugin.version}</version>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <echoproperties/>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
    
    0 讨论(0)
  • 2020-12-08 05:06

    Had the same issue. Changed the timeout and maxheap in findbugs configuration through maven.

    The below fixed it for me :

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <version>3.0.2</version>
                <configuration>
                    <maxHeap>2048</maxHeap>
                    <timeout>1800000</timeout>
                </configuration>
            </plugin>
    
    0 讨论(0)
提交回复
热议问题