Delombok using Gradle

十年热恋 提交于 2019-12-01 02:35:46

Using an Ant task is fine. No "Ant preconfiguration" should be necessary. Alternatively, you could use a JavaExec task to call delombok as in your last snippet. (JavaExec doesn't currently support the -jar option, so you'd have to name the main class.) Using a Maven plugin from Gradle isn't possible (except for executing Maven with an Exec task).

I think the easiest way to delombok sources with gradle is:

task delombok {
    description 'Delomboks the source code'
    ant.taskdef(classname: 'lombok.delombok.ant.Tasks$Delombok', classpath: configurations.compile.asPath,  name: 'delombok')
    ant.mkdir(dir: 'build/src-delomboked') 
    ant.delombok(verbose: 'true', encoding: 'UTF-8', to: 'build/src-delomboked', from: 'src/main/java')
}

https://github.com/franzbecker/gradle-lombok

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' }
    }
    dependencies {
        classpath 'io.franzbecker:gradle-lombok:1.6'
    }
}

apply plugin: 'java'
apply plugin: 'io.franzbecker.gradle-lombok'

UPD: at the moment I quite enough IntelliJ IDEA 2016.3 + Lombok plugin and the contents build.gradle:

dependencies {
    compileOnly 'org.projectlombok:lombok:+'
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!