The goals for the Compiler Plugin are bound to their respective phases in the build lifecycle. So to compile your sources, you need only to tell maven until which lifecycle to execute. The following will compile your sources:
To compile your test sources, you'll do:
The above command will execute both compiler:compile and compiler:testCompile since the compile phase happens a few phases before the test-compile phase.
Since the Compiler Plugin executes automatically during their phases, you don't have to put executions unlike many other plugins. However, you should specify the version of the Compiler Plugin.
<project> ... <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> <!-- put your configurations here --> </configuration> </plugin> </plugins> </pluginManagement> </build> ... </project>
Note: Maven 3.0 will issue warnings if you do not specify the version of a plugin.