lombok.config & gradle compilation

3,879 views
Skip to first unread message

Magic

unread,
Jul 23, 2014, 7:59:00 PM7/23/14
to project...@googlegroups.com
I am unsure how to use lombok.config with compilation in gradle.
While lombok.config works perfectly fine for me in Eclipse, I still haven't found a way to include it in the compilation process via gradle.

I've been trying to add it to classpath like so:

compileJava {
    classpath += files('src/main/resources/lombok.config')
}

but that doesn't seem to work.

Any ideas?

Martin Grajcar

unread,
Jul 23, 2014, 10:22:06 PM7/23/14
to project...@googlegroups.com
I only added

configure(subprojects) {
    dependencies {
        compile files('../REPO/lombok.jar')
    }
}

to my main build.gradle (I'm rather clueless with gradle) and it works. So I guess all you need is

dependencies {
    compile files('src/main/resources/lombok.config')
}



--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombo...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Magic

unread,
Jul 23, 2014, 11:28:10 PM7/23/14
to project...@googlegroups.com
No, that doesn't do it.
I believe it results in the same classpath - or in the file being on classpath, but it doesn't affect the compilation.

Is there any other way to pass config params to lombok?
Perhaps it's only the java agent that reads the file?

Martin Grajcar

unread,
Jul 23, 2014, 11:50:32 PM7/23/14
to project...@googlegroups.com
On Thu, Jul 24, 2014 at 5:28 AM, Magic <the4...@gmail.com> wrote:
No, that doesn't do it.
I believe it results in the same classpath - or in the file being on classpath, but it doesn't affect the compilation.

Is there any other way to pass config params to lombok?
Perhaps it's only the java agent that reads the file?

Sorry, I completely missed the point. My lombok.config resides in the same place as my Java files (and this is IMHO where it belongs to) and I had nothing to do for this.

Anyway, shouldn't

classpath += files('src/main/resources/lombok.config')

be

classpath += files('src/main/resources')

? The classpath never points to non-jar files, but to directories (or jars) where they're to be found. 

Magic

unread,
Jul 24, 2014, 12:11:29 AM7/24/14
to project...@googlegroups.com
I've tried that too. It didn't work.
I'm sure that the file is on classpath - I printed out all the classpath entries in my compileJava task.
But the config is still not picked up.

Reinier Zwitserloot

unread,
Aug 18, 2014, 9:00:07 AM8/18/14
to project...@googlegroups.com
lombok.config is found automatically. You should not put it on your classpath nor explicitly reference it from your build system. If you compile some java file with gradle and in the same directory as that java file, there is a lombok.config file, (or in any parent directory of the directory that contains the java file) and lombok does not find it, then that is a bug that we need to fix.

Magic

unread,
Aug 19, 2014, 7:05:01 PM8/19/14
to project...@googlegroups.com
That's how I tried to do it first, then with the config file in classpath. I never got it to work.

WonderCsabo

unread,
Apr 26, 2015, 2:48:10 PM4/26/15
to project...@googlegroups.com
Reiner,

i put the lombok config file with this content to my root source folder (src/main/java):

lombok.anyConstructor.suppressConstructorProperties = true
config.stopBubbling = true

But it seems lombok does not find the file, because ConstructorProperties still generated and compilation fails on Android...

I am positive the configuration file works with standard lombok, because when i run delombok, the ConstructorProperties is not there. If i remove the first line from the config, ConstructorProperties appears in the generated source.

should i open a new issue somewhere?

WonderCsabo

unread,
Apr 26, 2015, 2:48:10 PM4/26/15
to project...@googlegroups.com
Sorry, it seems i used old version of lombok in my build.gradle. I updated to the latest and it now works. :)
Reply all
Reply to author
Forward
0 new messages