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
Basic Setup
Add the following to yourpom.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>
Advanced Options
- Enable annotations:
<annotationProcessorPaths>
- Exclude test sources:
<excludeTestSources>true</excludeTestSources>
- Specify compiler arguments:
<compilerArgs>
- Enable annotations:
Common Issues
❌
Compilation error: Unsupported class version
Solution: Update<source>
and<target>
versions inpom.xml
⚠️
Plugin not found in repository
Check your Maven settings or try: /en/docs/Maven/repo_config
For deeper insights into plugin customization, visit our Maven Plugin Development Guide. 🚀