Maven Goals

Trying to understand maven can be tricky (esp. if you are coming from a VS background)

For me, the trick was to uderstand the whole deal with plugins and goals

Tips:

  • To keep things simple, one can just do:
<br />mvn exec:java -Dexec.mainClass="SimpleProducer" -Dexec.args="test"

  • Alternatively, we can use the exec-maven-plugin to add the config in the POM file, then  run the java goal  like so :  mvn exec:java
<br /><build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>SimpleProducer</mainClass>
<arguments>
<argument>test</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>

References:

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s