What is the basic difference between maven compiler plugin and maven surefire plugin?

Viewed 1960

What is the basic difference between maven compiler plugin and maven surefire plugin?

Also, I wanted to define system variables inside the pom.xml, under plugin configuration and read it from my java code(Using System.property()).

<configuration>
   <systemPropertyVariables>
       <envName>testEnv</envName>
   </systemPropertyVariables>
</configuration>

This configuration is working with maven surefire plugin and I am able to read it in my java file, however, same is not working with maven compiler plugin.

1 Answers

Those are two different plugins.

maven-compiler-plugin, as its name suggests, handles compiling your code.

maven-surefire-plugin handles [unit] test execution and failing the build process if there are test failures.

Related