aboutsummaryrefslogtreecommitdiff
path: root/website/templates/setup/gradle.html
blob: 69e2e71f81c129cf8d224e15360e4f3f86689714 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<#import "_setup.html" as s>

<@s.scaffold title="Gradle">
	<@s.introduction>
		<p>
			To set up lombok with any build tool, you have to specify that the lombok dependency is required to compile your source code, but does not need to be present when running/testing/jarring/otherwise deploying your code. Generally this is called a 'provided' dependency. This page explains how to integrate lombok with the <a href="https://gradle.org/">Gradle build tool</a>.
		</p><p>
			Lombok is available in maven central, so telling Gradle to download lombok is easy.
		</p>
	</@s.introduction>

	<@s.section title="The Lombok Gradle Plugin">
		<p>
			There is a plugin for gradle that we recommend you use; it makes deployment a breeze, and makes it easy to do additional tasks, such as delomboking. The plugin is open source. Read more <a href="https://plugins.gradle.org/plugin/io.freefair.lombok">about the gradle-lombok plugin</a>.
		</p>
	</@s.section>
	
	<@s.section title="Gradle without a plugin">
		<p>
			If you don't want to use the plugin, gradle has the built-in <code>compileOnly</code> scope, which can be used to tell gradle to add lombok only during compilation. Your <code>build.gradle</code> will look like:<pre>
repositories {
	mavenCentral()
}

dependencies {
	compileOnly 'org.projectlombok:lombok:${version}'
	annotationProcessor 'org.projectlombok:lombok:${version}'
	
	testCompileOnly 'org.projectlombok:lombok:${version}'
	testAnnotationProcessor 'org.projectlombok:lombok:${version}'
}</pre>
		</p><p>
			Remember that you still have to download <code>lombok.jar</code> (or find it in gradle's caches) and run it as a jarfile, if you wish to program in eclipse. The plugin makes that part easier.
		</p>
	</@s.section>

	<@s.section title="Android development">
		<p>
			Complete instructions for integrating lombok with your android development is available on our <a href="android">Using lombok for android development</a> page.
		</p>
	</@s.section>
</@s.scaffold>