tags:

views:

61

answers:

1

Anyone familiar with a way how can I can i write something to the stdout from maven.

For instance i would like to write a line everytime i start a new module.

+1  A: 

I would use the Maven AntRun plugin to echo the message and bind it on the validate phase (the first phase) of the default lifecyle in the parent pom:

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.3</version>
        <executions>
          <execution>
            <id>entering-module</id>
            <phase>validate</phase>
            <configuration>
              <tasks>
                <echo>Entering module: ${pom.artifactId}</echo>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

This is just an example of course, the message I'm writing here doesn't really add value to what Maven is already providing/doing.

Pascal Thivent