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

Difference of Maven JAXB plugins

Let’s summarize. We have/had: the maven-jaxb2-plugin (https://github.com/highsource/maven-jaxb2-plugin) the maven-jaxb-plugin (https://jaxb.dev.java.net/jaxb-maven2-plugin/) the jaxb2-maven-plugin (https://github.com/mojohaus/jaxb2-maven-plugin) Based on the comments of this thread, I’ve always used the maven-jaxb2-plugin (i.e. plugin #1): Concerning the org.jvnet.jaxb2.maven2:maven-jaxb2-plugin versus com.sun.tools.xjc.maven2:maven-jaxb-plugin, from my point of view it’s definitely the first one (http://maven-jaxb2-plugin.java.net/). This plugin has much more features than com.sun.tools.xjc.maven2:maven-jaxb-plugin, the development is … Read more

Is it possible to create an “uber” jar containing the project classes and the project dependencies as jars with a custom manifest file?

Actually, I didn’t check what the maven-shade-plugin is doing exactly (or any other plugin) as maven 2 has everything built-in to create a megajar or uberjar. You just have to use the maven-assembly-plugin with the predefined jar-with-dependencies descriptor. Just add this snippet to your pom.xml to customize the manifest: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <configuration> <archive> <manifest> … Read more

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