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:
- https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
- http://www.mojohaus.org/exec-maven-plugin/usage.html
- https://maven.apache.org/run-maven/