I have an Eclipse project which makes use of Lombok for annotations. One such annotation is @Access. The Eclipse compiler cannot see this, even if I explicitly put lombok.jar in the classpath of the project. I wish I could just get the Eclipse plugin to work, but would settle for modifying the build scripts and not checking them in.
Lombok jar version 1.18.22 Eclipse (Tried latest MyEclipse, and 2021-09). Running on Linux
Based on the project instructions, I ran
java -jar lombok.jar
and specified my Eclipse directory.
It copied lombok.jar to the Eclipse directory and modified the eclipse.ini file to be this:
-startup
plugins/org.eclipse.equinox.launcher_1.6.300.v20210813-1054.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.2.300.v20210828-0802
-product
org.eclipse.epp.package.jee.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm
plugins/org.eclipse.justj.openjdk.hotspot.jre.full.linux.x86_64_16.0.2.v20210721-1149/jre/bin
-vmargs
-Dosgi.requiredJavaVersion=11
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-Dsun.java.command=Eclipse
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=11
-Dosgi.dataAreaRequiresExplicitInit=true
-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true
-Xms256m
-Xmx2048m
--add-modules=ALL-SYSTEM
-javaagent:lombok.jar
But the annotation processing still does not work. I'm in a Gradle shop, but I wasn't sure where to put the either the plugin modification or non-plugin gradle modification. I tried adding
compileOnly 'org.projectlombok:lombok:1.18.8'
annotationProcessor 'org.projectlombok:lombok:1.18.8'
directly to the dependencies, but it did not care.
My Gradle file does not look the same as the examples specified. My build.gradle is:
import org.apache.tools.ant.filters.ReplaceTokens
import org.gradle.api.JavaVersion
apply plugin: "distribution"
apply plugin: "idea"
apply plugin: "io.spring.dependency-management"
apply plugin: "jacoco"
apply plugin: "java"
apply plugin: "maven"
apply plugin: "org.liquibase.gradle"
apply plugin: "org.springframework.boot"
// apply plugin: "org.unbroken-dome.test-sets"
def javaVersion = JavaVersion.VERSION_11;
sourceCompatibility = javaVersion;
targetCompatibility = javaVersion; // defaults to sourceCompatibility
bootRun {
systemProperties = System.properties
systemProperty 'management.info.git.mode', 'FULL'
}
ext {
groupId = project.property('groupId')
version = project.property('version')
fernCommonVersion = project.property('fernCommonVersion')
walnutCommonVersion = project.property('walnutCommonVersion')
}
group groupId
version version
buildscript {
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
// classpath group: "gradle.plugin.org.unbroken-dome.gradle-plugins", name: "gradle-testsets-plugin", version: "1.4.2"
classpath group: "io.spring.gradle", name: "dependency-management-plugin", version: "1.0.10.RELEASE"
classpath group: "org.codehaus.groovy", name: "groovy-all", version: "2.0.1"
classpath group: "org.codehaus.groovy", name: "groovy-xml", version: "2.0.1"
classpath group: "org.liquibase", name: "liquibase-gradle-plugin", version: "2.0.1"
classpath group: "org.postgresql", name: "postgresql", version: "42.2.0"
classpath group: "org.springframework.boot", name: "spring-boot-gradle-plugin", version: "2.3.4.RELEASE"
classpath group: "pl.project13.maven", name: "git-commit-id-plugin", version: "2.2.1"
}
}
jacoco {
toolVersion = "0.8.5"
reportsDir = file("$buildDir/reports/jacoco")
}
jacocoTestReport {
reports {
xml.enabled true
csv.enabled false
xml.destination file("${buildDir}/reports/jacoco/coverage.xml")
html.destination file("${buildDir}/reports/jacoco/html")
}
}
springBoot {
mainClassName = 'com.tii.walnut.manager.AcornManagerApplication'
buildInfo {
// Generate extra build info.
properties {
additional = [
by : System.properties['user.name'],
operatingSystem: "${System.properties['os.name']} (${System.properties['os.version']})",
// machine: InetAddress.localHost.hostName,
// Override buildInfo property time
time : buildTime()
]
}
}
}
def buildTime() {
final dateFormat = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ")
dateFormat.timeZone = java.util.TimeZone.getTimeZone('GMT')
dateFormat.format(new Date())
}
repositories {
mavenLocal()
maven { url 'http://bin-repo.iparadigms.com/artifactory/libs-release' }
maven { url 'http://bin-repo.iparadigms.com/artifactory/libs-snapshot' }
mavenCentral()
maven { url "http://repo.spring.io/release" }
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://jitpack.io" }
maven { url "http://dl.bintray.com/typesafe/maven-releases" }
maven { url "https://repository.apache.org/snapshots" }
}
sourceSets {
main {
java.srcDir 'src/main/java'
}
test {
java.srcDir 'src/test/java'
resources.srcDir 'src/test/resources'
}
}
configurations {
codacy
// we use the tii commons logging module for logging
compile.exclude module: 'log4j12'
compile.exclude module: 'slf4j-log4j12'
compile.exclude module: 'log4j-slf4j-impl'
compile.exclude module: 'log4j-core'
compile.exclude module: 'log4j-api'
compile.exclude module: 'spring-boot-starter-tomcat'
compile.exclude module: 'log4j-over-slf4'
}
dependencies {
compile (group: "com.tii", name: "fern-common", version: "${fernCommonVersion}") {
exclude group: "org.springframework.boot"
exclude group: "org.slf4j"
exclude module: 'spring-boot-starter-jetty'
}
compile group: "com.tii.walnut", name: "walnut-common", version: "${walnutCommonVersion}"
compile (group: 'com.turnitin.commons', name: 'logging', version: '0.0.2') {
exclude group: "org.springframework.boot"
}
compile (group: 'com.turnitin.commons', name: 'stream', version: '1.2-SNAPSHOT') {
// sadly the common libraries have incorrectly defined dependencies on Spring - this leads to version mismatches
exclude group: "org.springframework.boot"
exclude group: "org.springframework"
}
compile group: 'com.turnitin.commons', name: 'metrics', version: '0.3.8'
compile group: "com.fasterxml.jackson.dataformat", name: "jackson-dataformat-yaml"
compile group: "com.google.guava", name: "guava", version: "23.0"
compile group: 'com.jayway.jsonpath', name: 'json-path', version: '2.5.0'
compile group: "com.newrelic.agent.java", name: "newrelic-api", version: "4.1.0"
compile group: 'com.opencsv', name: 'opencsv', version: '5.5.1'
compile group: "com.squareup.okhttp3", name: "okhttp", version: "3.6.0"
compile group: "com.vladmihalcea", name: "hibernate-types-52", version: "2.9.11"
compile group: "io.jsonwebtoken", name: "jjwt", version: "0.7.0"
compile group: 'io.springfox', name: 'springfox-boot-starter', version: '3.0.0'
compile group: "net.jodah", name: "failsafe", version: "2.4.0"
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.4'
compile group: "org.apache.commons", name: "commons-lang3", version: "3.9"
compile group: "org.aspectj", name: "aspectjweaver", version: "1.8.8"
compile (group: "org.codehaus.janino", name: "commons-compiler", version: "3.0.8") {
force = true
exclude group: "org.codehaus.janino", module: "janino"
}
compile group: "org.codehaus.janino", name: "janino", version: "3.0.8"
compile group: "org.functionaljava", name: "functionaljava-java8", version: "4.7"
compile group: "org.hibernate", name: "hibernate-c3p0", version: "5.2.10.Final"
compile group: "org.hibernate", name: "hibernate-java8", version: "5.2.10.Final"
compile group: "org.postgresql", name: "postgresql", version: "42.2.1"
compile group: "org.springframework", name: "spring-context-support"
compile group: "org.springframework.boot", name: "spring-boot-starter"
compile group: "org.springframework.boot", name: "spring-boot-starter-actuator"
compile group: "org.springframework.boot", name: "spring-boot-starter-data-jpa"
compile group: "org.springframework.boot", name: "spring-boot-starter-jdbc"
compile group: "org.springframework.boot", name: "spring-boot-starter-web"
compile group: "org.springframework.boot", name: "spring-boot-starter-webflux"
compile group: 'org.springframework.boot', name: 'spring-boot-starter-jetty'
compile group: 'org.springframework.plugin', name: 'spring-plugin-core'
compile group: 'com.turnitin.commons', name: 'launchdarkly', version: '0.0.13'
runtime group: "org.springframework.boot", name: "spring-boot-devtools"
runtime("ch.qos.logback:logback-core")
testCompile group: "org.apiguardian", name: "apiguardian-api", version: "1.0.0"
testCompile group: "org.awaitility", name: "awaitility", version: "3.0.0"
testCompile group: "org.junit.jupiter", name: "junit-jupiter-api", version: "5.3.2"
testCompile group: "org.junit.jupiter", name: "junit-jupiter-params", version: "5.3.2"
testCompile group: "org.liquibase", name: "liquibase-core", version: "3.6.3"
testCompile group: "org.lz4", name: "lz4-java", version: "1.4.1"
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.28.2'
testCompile group: "org.springframework", name: "spring-test"
testCompile group: "org.springframework.boot", name: "spring-boot-starter-test"
liquibaseRuntime group: "ch.qos.logback", name: "logback-classic", version: "1.2.3"
liquibaseRuntime group: "ch.qos.logback", name: "logback-core", version: "1.2.3"
liquibaseRuntime group: "org.liquibase", name: "liquibase-core", version: "3.6.3"
liquibaseRuntime group: "org.postgresql", name: "postgresql", version: "42.2.1"
liquibaseRuntime group: "org.slf4j", name: "slf4j-api", version: "1.7.25"
testRuntime group: "org.junit.jupiter", name: "junit-jupiter-engine", version: "5.3.2"
codacy group: "com.github.codacy", name: "codacy-coverage-reporter", version: "-SNAPSHOT"
}
ext.testsRegEx = project.hasProperty('tests') ? project.getProperty('tests') : "*"
test {
jacoco {
append = false
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
classDumpDir = file("$buildDir/jacoco/classpathdumps")
}
useJUnitPlatform {
excludeTags 'slow'
}
filter {
includeTestsMatching "${testsRegEx}"
}
minHeapSize = "4g"
maxHeapSize = "8g"
reports.junitXml.destination = file('build/test-results/junit-platform')
testLogging {
exceptionFormat = 'full'
events = ["passed", "skipped", "failed"]
}
if (System.getProperty('DEBUG', 'false') == 'true') {
jvmArgs '-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9099'
}
}
liquibase {
activities {
// new Dev env
uscald {
changeLogFile 'src/main/resources/database/Changelog.xml'
url 'jdbc:postgresql://dev-walnut-leader.uscald:5432/walnut?currentSchema=manager'
username 'walnut_admin'
password 'somepasswd'
liquibaseSchemaName 'public'
}
}
runList = 'uscald'
}
install.dependsOn(bootJar)
distributions {
main {
contents {
from jar
}
}
}
// this for debugging remotely - add -DDEBUG=true to the command line - remote debug at 9099
tasks.withType(JavaExec) {
if (System.getProperty('DEBUG', 'false') == 'true') {
jvmArgs '-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9099'
}
}
// generated from bootstrap-jet - begin
task resolveDependencies {
doLast {
project.rootProject.allprojects.each { subProject ->
subProject.buildscript.configurations.each { configuration ->
resolveConfiguration(configuration)
}
subProject.configurations.each { configuration ->
resolveConfiguration(configuration)
}
}
}
}
void resolveConfiguration(configuration) {
if (isResolveableConfiguration(configuration)) {
configuration.resolve()
}
}
boolean isResolveableConfiguration(configuration) {
def nonResolveableConfigurations = ['apiElements', 'implementation',
'runtimeElements', 'runtimeOnly',
'testImplementation', 'testRuntimeOnly',
'generatedImplementation', 'generatedRuntimeOnly']
if (nonResolveableConfigurations.contains(configuration.getName())) {
return false
}
return true
}
// generated from bootstrap-jet - end