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:test-compile 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 the other plugins.
<project> ... <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.1</version> <configuration> <!-- put your configurations here --> </configuration> </plugin> </plugins> </build> ... </project>