How to display maven properties in Eclipse?
The pom below, based on antrun plugin is not work:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Test_DisplayMavenVariables</groupId>
<artifactId>Test_DisplayMavenVariables</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<testproperty>This is a test property</testproperty>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>Displaying value of 'testproperty' property</echo>
<echo>[testproperty] ${testproperty}</echo>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
UPDATE
If ran to goal "validate", the output is following:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Test_DisplayMavenVariables 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.110s
[INFO] Finished at: Sun Mar 23 15:22:00 MSK 2014
[INFO] Final Memory: 4M/183M
[INFO] ------------------------------------------------------------------------
You have put the antrun
definition inside a pluginManagement
block.
pluginManagement
means: "if someone uses this plugin, he will do it in the following way..."
In your example, no one uses the plugin, since there is no normal plugin definition. Remove <pluginManagement>
and </pluginManagement>
from your pom, and it will work.