How do I execute a program using Maven?

With the global configuration that you have defined for the exec-maven-plugin: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.4.0</version> <configuration> <mainClass>org.dhappy.test.NeoTraverse</mainClass> </configuration> </plugin> invoking mvn exec:java on the command line will invoke the plugin which is configured to execute the class org.dhappy.test.NeoTraverse. So, to trigger the plugin from the command line, just run: mvn exec:java Now, if you want … Read more

I want to execute shell commands from Maven’s pom.xml

Here’s what’s been working for me: <plugin> <artifactId>exec-maven-plugin</artifactId> <groupId>org.codehaus.mojo</groupId> <executions> <execution><!– Run our version calculation script –> <id>Version Calculation</id> <phase>generate-sources</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>${basedir}/scripts/calculate-version.sh</executable> </configuration> </execution> </executions> </plugin>

Maven 2 assembly with dependencies: jar under scope “system” not included

I’m not surprised that system scope dependencies are not added (after all, dependencies with a system scope must be explicitly provided by definition). Actually, if you really don’t want to put that dependency in your local repository (for example because you want to distribute it as part of your project), this is what I would … Read more

Sharing Test code in Maven

I recommend using type instead of classifier (see also: classifier). It tells Maven a bit more explicitly what you are doing (and I’ve found that m2eclipse and q4e both like it better). <dependency> <groupId>com.myco.app</groupId> <artifactId>foo</artifactId> <version>1.0-SNAPSHOT</version> <type>test-jar</type> <scope>test</scope> </dependency>