Maven Compiler Plugin

August 10, 2016 ・0comments

The Maven Compiler Plugin is used to compile the Java source code of your project. The default compiler is `javac`, which is used to compile Java sources. By modifying the `pom.xml` file, you can customize the default behavior of the Maven Compiler Plugin.

Using Maven Compiler Plugin, you can compile the source code of a certain project to a different version of JVM than what you are currently using. EX: compile using JDK 1.8 and target JVM is 1.7. Default source setting is JDK 1.5, and the default target setting is JDK 1.5

Example configuration is as below: 

<build>
    <plugins>
        <plugin>
           <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>

Post a Comment