If you want to execute a program you can use the exec-maven-plugin. This is demonstrated in the following pom.xml file. To trigger this use the exec:java target in maven.
<project> <modelVersion>4.0.0</modelVersion> <groupId>com.vogella.build.maven.intro</groupId> <artifactId>com.vogella.build.maven.intro</artifactId> <version>0.0.1-SNAPSHOT</version> <name>mavenintroduction</name> <build> <sourceDirectory>src</sourceDirectory> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>com.vogella.build.maven.intro.Main</mainClass> </configuration> </plugin> </plugins> </build> </project>
<project> <modelVersion>4.0.0</modelVersion> <groupId>com.vogella.build.maven.intro</groupId> <artifactId>com.vogella.build.maven.intro</artifactId> <version>0.0.1-SNAPSHOT</version> <name>mavenintroduction</name> <build> <sourceDirectory>src</sourceDirectory> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>com.vogella.build.maven.intro.Main</mainClass> </configuration> </plugin> </plugins> </build> </project>