mirror of
https://github.com/tiennm99/lombok.git
synced 2026-07-31 16:21:48 +00:00
* Update copyright headers * Update code style (tabs, not spaces, spaces around + operator - that's about it) * Use `x.class.getResourceAsStream`, not `x.getClass().` - minor mostly irrelevant nit. * Rename and re-locate the jar itself. * 'ecj' as an alias for this command seems a bit too cavalier' removed it. * The source is in its own 'root' src dir, it doesn't really fit in the eclipse agent sources - it's more a maven agent. * Fixed a bug where a filehandle wasn't safe closed. Mostly irrelevant (JVM would quite afterwards anyway). * Slight rewording of the ecj docs.
82 lines
3.4 KiB
HTML
82 lines
3.4 KiB
HTML
<#import "_setup.html" as s>
|
|
|
|
<@s.scaffold title="ECJ">
|
|
<@s.introduction>
|
|
<p>
|
|
ECJ (the Eclipse standalone compiler) is compatible with Lombok. Use the following command line to enable Lombok with ECJ:
|
|
<pre>java <strong>-javaagent:lombok.jar=ECJ</strong> -jar ecj.jar -cp lombok.jar -source 1.8 <em class="note">(rest of arguments)</em></pre>
|
|
</p><p>
|
|
You may have to add the following VM argument, if you're using an older version of Lombok or Java:
|
|
<pre><strong>-Xbootclasspath/p:lombok.jar</strong></pre>
|
|
</p><p>
|
|
If you're using a tool based on ECJ, adding these VM arguments and adding <code>lombok.jar</code> to the classpath should work.
|
|
</p>
|
|
</@s.introduction>
|
|
|
|
<@s.section title="Maven">
|
|
<p>
|
|
Lombok comes with a tiny bootstrap agent that can be included in your project to allow ECJ to easily work with Maven.
|
|
To create this agent, run:
|
|
<pre>java -jar lombok.jar createMavenECJBootstrap -o <em class="note">/path/to/project/root</em></pre>
|
|
</p><p>
|
|
The -o path should contain your <code>pom.xml</code>.
|
|
</p><p>
|
|
This will create two files, <code>.mvn/jvm.config</code> and <code>.mvn/lombok-bootstrap.jar</code>. Maven will use these files
|
|
to activate the standard Lombok Java agent at the right time. These can be committed in source control for a portable build.
|
|
</p><p>
|
|
You must also update your <code>pom.xml</code> to add Lombok as a dependency to the <code>maven-compiler-plugin</code>. A minimal example follows:<pre>
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
<modelVersion>4.0.0</modelVersion>
|
|
|
|
<groupId>org.projectlombok</groupId>
|
|
<artifactId>eclipse-compiler-test</artifactId>
|
|
<version>1.0-SNAPSHOT</version>
|
|
|
|
<properties>
|
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
<lombok.version>${version}</lombok.version>
|
|
</properties>
|
|
|
|
<dependencies>
|
|
<dependency>
|
|
<groupId>org.projectlombok</groupId>
|
|
<artifactId>lombok</artifactId>
|
|
<version>${lombok.version}</version>
|
|
<scope>provided</scope>
|
|
</dependency>
|
|
</dependencies>
|
|
|
|
<build>
|
|
<pluginManagement>
|
|
<plugins>
|
|
<plugin>
|
|
<artifactId>maven-compiler-plugin</artifactId>
|
|
<version>3.10.1</version>
|
|
<configuration>
|
|
<compilerId>eclipse</compilerId>
|
|
</configuration>
|
|
<dependencies>
|
|
<dependency>
|
|
<groupId>org.codehaus.plexus</groupId>
|
|
<artifactId>plexus-compiler-eclipse</artifactId>
|
|
<version>2.11.1</version>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>org.projectlombok</groupId>
|
|
<artifactId>lombok</artifactId>
|
|
<version>${lombok.version}</version>
|
|
</dependency>
|
|
</dependencies>
|
|
</plugin>
|
|
</plugins>
|
|
</pluginManagement>
|
|
</build>
|
|
</project>
|
|
</pre>
|
|
</p>
|
|
</@s.section>
|
|
</@s.scaffold>
|