Skip to content

Instantly share code, notes, and snippets.

@MickaelBaye
Last active December 15, 2015 23:29
Show Gist options
  • Save MickaelBaye/5340592 to your computer and use it in GitHub Desktop.
Save MickaelBaye/5340592 to your computer and use it in GitHub Desktop.
[MAVEN] POM with Java execution goal
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.application</groupId>
<artifactId>application</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>application</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.example.application.App</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
@MickaelBaye
Copy link
Author

How to use :

mvn exec:java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment