Lombok installer did not work for Eclipse with Gradle project - eclipse

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

Related

Automatically Add built source files in STS 4?

Currently I'm stuck with automatically added built source files after compiled.
QueryDSL IS WORKING (automatically added after refresh.).
However, MapStruct is not working.
QueryDSL Output is src/main/generated/querydsl, each of projects.
MapStruct is default (build/generated/sources/annotationProcessor/java/main) on their projects.
After add source files manually, this code is works, But I want to add source automatically like querydsl.
here is my part of build.gradle.
// Root build.gradle
buildscript {
ext {
springBootVersion = '2.7.2'
dependencyManagementVersion = '1.0.12.RELEASE'
mysqlVersion = '8.0.30'
lombokVersion = '6.5.0.3'
queryDslVersion = '4.4.0'
queryDslPluginVersion = '1.0.10'
mapStructVersion = '1.5.3.Final'
lombokMapstructBindingVersion = "0.2.0"
}
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
classpath "io.spring.gradle:dependency-management-plugin:${dependencyManagementVersion}"
classpath "io.freefair.gradle:lombok-plugin:${lombokVersion}"
// for QueryDSL
classpath "gradle.plugin.com.ewerk.gradle.plugins:querydsl-plugin:${queryDslPluginVersion}"
}
}
subprojects {
group = 'test.test'
version '0.0.1-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'io.freefair.lombok'
apply plugin: 'com.ewerk.gradle.plugins.querydsl'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
dependencies {
compile group: 'com.querydsl', name: 'querydsl-jpa'
annotationProcessor group: 'com.querydsl', name: 'querydsl-apt'
// for QueryDSL
// implementation "com.querydsl:querydsl-core:${queryDslVersion}"
// implementation "com.querydsl:querydsl-jpa:${queryDslVersion}"
// annotationProcessor "com.querydsl:querydsl-apt:${queryDslVersion}:jpa"
annotationProcessor "jakarta.persistence:jakarta.persistence-api"
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
annotationProcessor "org.mapstruct:mapstruct-processor:${mapStructVersion}"
implementation "org.mapstruct:mapstruct:${mapStructVersion}"
annotationProcessor "org.projectlombok:lombok-mapstruct-binding:${lombokMapstructBindingVersion}"
testImplementation 'junit:junit:4.12'
}
}
// for QueryDSL
task cleanGeneatedDir(type: Delete) {
delete file('src/main/generated')
}
// A Project build.gradle
dependencies {
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-security'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa'
implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.6.11'
implementation 'com.querydsl:querydsl-jpa:4.4.0'
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
}
def querydslDir = "src/main/generated/querydsl"
querydsl {
library = "com.querydsl:querydsl-apt"
jpa = true
querydslSourcesDir = querydslDir
}
sourceSets {
main.java.srcDir querydslDir
}
compileQuerydsl{
options.annotationProcessorPath = configurations.querydsl
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
querydsl.extendsFrom compileClasspath
}
It automatically configured by sourceSets > main > java > srcDirs in gradle.
in codes,
sourceSets {
main {
java {
srcDirs = ['src/main/java', 'build/generated/sources/annotationProcessor/java/main']
}
}
}

Gradle doesn't execute scalatests

I have created scalatest for my spark project and when I am running gradle task "test" then it doesn't execute a single test. It shows zero tests.
Even as part of the build process, gradle doesn't execute any test case. It seems that gradle is not able to discover any test.
Build.gradle:
============
plugins {
id "maven-publish"
id "scala"
id 'java'
id 'jacoco'
}
scala {
zincVersion = "1.2.1"
}
repositories {
mavenLocal()
jcenter()
mavenCentral()
maven {
url 'http://conjars.org/repo'
}
}
dependencies {
compile "org.scala-lang:scala-library:"+scalaVersion
compile "org.scala-lang:scala-reflect:"+scalaVersion
compile "org.scala-lang:scala-compiler:"+scalaVersion
compile('org.apache.spark:spark-core_2.12:2.4.6')
compile('org.apache.spark:spark-sql_2.12:2.4.6')
compile('com.typesafe.scala-logging:scala-logging-slf4j_2.11:2.1.2')
compile('ch.hsr:geohash:1.3.0')
compile('joda-time:joda-time:2.3')
compile('org.json4s:json4s-jackson_2.11:3.7.0-M4')
compile('org.apache.httpcomponents:httpclient:4.5.6')
compile('com.fasterxml.jackson.datatype:jackson-datatype-joda:2.5.1')
compile 'com.typesafe:config:1.4.1'
implementation 'com.google.guava:guava:29.0-jre'
testCompile 'junit:junit:4.12'
testCompile 'org.scalatest:scalatest_2.12:3.2.0'
testCompile ("org.mockito:mockito-scala_2.12:1.16.42")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.7.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.4.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.4.2")
testCompile group: 'com.holdenkarau', name: 'spark-testing-base_2.12', version: '2.4.5_1.0.0'
compile 'org.scala-lang.modules:scala-xml_2.12:1.2.0'
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}

Flyway version 7.5.1 and up can not initialize Zonky-test DB

With Flyway version 7.5.0, it still works fine. Version 7.5.1 and 7.5.2 however, produce the following error:
[...]
java.lang.IllegalStateException: Unexpected error occurred while initializing the data source
at com.google.common.base.Preconditions.checkState(Preconditions.java:459)
at io.zonky.test.db.flyway.DefaultFlywayDataSourceContext.getTarget(DefaultFlywayDataSourceContext.java:89)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:195)
at com.sun.proxy.$Proxy65.getConnection(Unknown Source)
at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:59)
at org.flywaydb.core.internal.jdbc.JdbcConnectionFactory.<init>(JdbcConnectionFactory.java:69)
at org.flywaydb.core.Flyway.execute(Flyway.java:507)
at org.flywaydb.core.Flyway.migrate(Flyway.java:165)
at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:66)
[...]
Any idea, what's the problem or how to fix it?
Below is the code of my minimal example to reproduce the problem:
Dockerfile
FROM openjdk:11.0.10-jdk AS base
# Needed for embedded PostgreSQL-server to start during integration tests.
# see: https://github.com/zonkyio/embedded-database-spring-test
RUN groupadd --system --gid 1000 test
RUN useradd --system --gid test --uid 1000 --shell /bin/bash --create-home test
USER test
WORKDIR /home/test
ADD . /home/test/
RUN ./gradlew test
build.gradle
buildscript {
ext {
kotlinVersion = '1.4.21'
springBootVersion = '2.4.2'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-noarg:${kotlinVersion}")
}
}
apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
apply plugin: 'kotlin-jpa'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'com.acme'
version = '1.0.0-SNAPSHOT'
sourceCompatibility = 1.8
compileKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "1.8"
}
}
repositories {
mavenCentral()
}
dependencies {
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: "${springBootVersion}"
implementation group: 'org.postgresql', name: 'postgresql', version: '42.2.18'
implementation group: 'org.flywaydb', name: 'flyway-core', version: '7.5.2'
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: "${kotlinVersion}"
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: "${springBootVersion}"
testImplementation group: 'junit', name: 'junit', version: '4.13.1'
testImplementation group: 'io.zonky.test', name: 'embedded-database-spring-test', version: '1.6.2'
}
test {
testLogging {
exceptionFormat = 'full'
}
}
compileKotlin.dependsOn(processResources)
compileJava.dependsOn(processResources)
settings.gradle
rootProject.name = 'flywayzonkytest'
src/main/kotlin/com/acme/flywayzonkytest/Application.kt
package com.acme.flywayzonkytest
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
#SpringBootApplication
class Application
fun main(args: Array<String>) {
runApplication<Application>(*args)
}
src/main/resources/application.yml
spring:
flyway:
enabled: true
src/main/resources/db/migration/V1__thing.sql
CREATE TABLE thing (
some_id BIGINT PRIMARY KEY NOT NULL,
some_name VARCHAR NOT NULL
);
src/test/kotlin/com/acme/flywayzonkytest/integration/CreateContextTest.kt
package com.acme.flywayzonkytest.integration
import io.zonky.test.db.AutoConfigureEmbeddedDatabase
import org.junit.Test
import org.junit.runner.RunWith
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.junit4.SpringRunner
#RunWith(SpringRunner::class)
#AutoConfigureEmbeddedDatabase
#SpringBootTest
class CreateContextTest {
#Test
fun `test create context`() {
}
}
Flyway had some breaking changes between version 7.5.0 and 7.5.1. The maintainer of zonkyio/embedded-database-spring-test just implemented a fix/workaround in his library, which is included in version 1.6.3. :-)

How to add generated sources for scala protobuf plugin using gradle?

I use gradle for building and want to generate some scala code for protobuf using this plugin: https://github.com/CharlesAHunt/scalapb-gradle-plugin
My gradle.build:
group 'xxxx'
version '1.0-SNAPSHOT'
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.charlesahunt:scalapb-plugin:1.2.4"
}
}
repositories {
mavenCentral()
}
apply plugin: 'com.charlesahunt.scalapb'
apply plugin: 'java'
apply plugin: 'scala'
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
implementation 'org.scala-lang:scala-library:2.12.8'
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
compile group: 'com.typesafe', name: 'config', version: '1.3.4'
testCompile group: 'org.scalatest', name: 'scalatest_2.12', version: '3.0.8'
}
scalapbConfig {
protocVersion = "-v360"
grpc = false
targetDir = "build/generated/scala"
projectProtoSourceDir = "src/main/protobuf"
extractedIncludeDir = "build/external_protos"
}
sourceSets {
generated {
scala.srcDirs += "build/generated/"
}
}
compileScala {
dependsOn scalapb
}
The problem is that generated code isn't visible for my code and i can't use it. I tried to change targetDir and scala.srcDirs but it didn't help.
How can i solve this problem?
p.s. i use IntelliJ

W.r.t. Pass options to JPAAnnotationProcessor from Gradle

I am using Gradle version 2.14, I have made changes in build.gradle to exclude packages from JPAAnnotationProcessor as mentioned in question.
My build.gradle configuration for same as follows:
configurations {
querydslapt
}
dependencies{
compile group: 'com.querydsl', name: 'querydsl-core', version: '4.1.4'
compile group: 'com.querydsl', name: 'querydsl-apt', version: '4.1.4'
compile group: 'com.querydsl', name: 'querydsl-jpa', version: '4.1.4'
}
task generateQueryDSL(type: JavaCompile, group: 'build', description: 'Generates the QueryDSL query types') {
source =sourceSets.main.java
classpath = configurations.compile + configurations.querydslapt
options.compilerArgs = [
"-proc:only",
"-processor", "com.querydsl.apt.jpa.JPAAnnotationProcessor",
"-Aquerydsl.excludedPackages=com.projectx.data.domain.poc.lombok"
]
destinationDir = sourceSets.generated.java.srcDirs.iterator().next()
}
compileJava {
dependsOn generateQueryDSL
source generateQueryDSL.destinationDir
}
compileGeneratedJava {
dependsOn generateQueryDSL
options.warnings = false
classpath += sourceSets.main.runtimeClasspath
}
But when I am building application I getting warning as warning: The following options were not recognized by any processor: '[querydsl.excludedPackages]'
And specified packages are not excluded from preprocessing.
Found a solution!
After adding querydsl.entityAccessors=true to aptOptions warning still present, but excluding packages works!
In your case, you should try add -Aquerydsl.entityAccessors=true to options.compilerArgs =[]
hope it helps
UPDATED
Just noticed that you use lombook in your project.
Found this one ( How to make QueryDSL and Lombok work together ) Hope it could be helpful for you!