tags:

views:

59

answers:

1

How can i display a message in Maven? In ant, we do have "echo" to display a message, but in maven, how can i do that?

+3  A: 

You can use the antrun plugin:

<plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
        <execution>
            <phase>generate-resources</phase>
            <goals>
                <goal>run</goal>
            </goals>
            <configuration>
                <tasks>
                    <echo>Hello world!</echo>
                </tasks>
            </configuration>
        </execution>
    </executions>
</plugin>

One issue though is that you have to choose what phase of the build lifecycle to bind this to (my example has the plugin bound to generate-resources). Unlike Ant, you aren't controlling the lifecycle yourself, but rather just binding plugins to certain points in a pre-defined lifecycle. Depending on what you are actually trying to do, this may or may not make sense for your use case.

matt b