Welcome to the Maven Compiler Plugin documentation! This guide will help you understand how to configure and use the compiler plugin in your Maven projects. 🔧

What is the Maven Compiler Plugin?

The Maven Compiler Plugin is a core component that manages the compilation of source code in your project. It supports multiple languages including Java, Kotlin, and Scala. 🌐

Key Features

  • Default Compiler: Uses javac for Java projects
  • Custom Configurations: Supports specifying source/target versions
  • Multi-Language Support: Easily extendable for other languages

How to Configure

  1. Basic Setup
    Add the following to your pom.xml:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
  2. Advanced Options

    • Enable annotations: <annotationProcessorPaths>
    • Exclude test sources: <excludeTestSources>true</excludeTestSources>
    • Specify compiler arguments: <compilerArgs>

Common Issues

  • Compilation error: Unsupported class version
    Solution: Update <source> and <target> versions in pom.xml

  • ⚠️ Plugin not found in repository
    Check your Maven settings or try: /en/docs/Maven/repo_config

Maven Compiler Plugin

For deeper insights into plugin customization, visit our Maven Plugin Development Guide. 🚀