I am trying to copy all the dependencies to libs folder, but it isn't working with the copyDependency task. I've tried few tweaks with the task, however it won't copy. Below is my build.gradle file
plugins {
id 'java'
id 'maven-publish'
}
repositories {
mavenLocal()
maven {
url = uri('https://repo.maven.apache.org/maven2/')
}
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter-batch:2.0.2.RELEASE'
compile 'org.springframework.boot:spring-boot-starter-jdbc:2.0.2.RELEASE'
compile 'org.springframework.boot:spring-boot-starter-web:2.0.2.RELEASE'
compile 'org.springframework.boot:spring-boot-starter-actuator:2.0.2.RELEASE'
compile 'org.postgresql:postgresql:42.2.2'
compile 'com.h2database:h2:1.4.197'
compile 'com.amazonaws:aws-java-sdk:1.11.290'
compile 'org.spockframework:spock-core:1.0-groovy-2.4'
compile 'org.codehaus.groovy:groovy-all:2.4.1'
compile 'com.github.ulisesbocchio:jasypt-spring-boot-starter:1.15'
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.0.2.RELEASE'
testImplementation 'org.springframework.batch:spring-batch-test:4.0.1.RELEASE'
}
group = 'com.loyalty.finance'
description = 'Spring Boot and batch integrated project for fin-issuance-processor'
java.sourceCompatibility = JavaVersion.VERSION_1_8
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
task copyDependencies(type: Copy) {
from configurations.runtime
into 'libs'
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
Related
I'm trying a libgdx project depending on a lib published in local repo with maven-publish:
// to publish locally:
// ~/gdx-gltf$ ./gradlew gltf:publishToMavenLocal
apply plugin: 'maven-publish'
publishing {
publications {
mavenJava(MavenPublication) {
groupId = 'io.github.odys-z'
artifactId = 'gdx-gltf'
version = '0.1.0-SNAPSHOT'
from components.java
}
}
}
When I running the depending desktop with gradlew CLI, it's working:
./gradlew desktop:run
But in eclipse and right click the BasicTweenTest class (gradle project.ext.mainClassName) and run as java application, eclipse reported errors:
com.badlogic.gdx.utils.GdxRuntimeException: java.lang.Error: Unresolved compilation problems:
sceneAsset cannot be resolved to a variable
GLTFLoader cannot be resolved to a type
SceneModel cannot be resolved to a type
scenes cannot be resolved or is not a field
animationLoader cannot be resolved to a variable
The missing type is in the local repo dependency, gdx-gltf-0.1.0-SNAPSHOT. No matter what I cleaned projects or refreshed gradle, the error persisting appear.
Eclipse Screenshot with stacktrace report
desktop/build.gradle:
apply plugin: "java"
sourceCompatibility = 1.8
sourceSets.main.java.srcDirs = [ "src/", "test/" ]
sourceSets.main.resources.srcDirs = ["../android/assets", "test"]
// project.ext.mainClassName = "io.oz.wnw.norm.desktop.DesktopLauncher"
// project.ext.mainClassName = "io.oz.wnw.norm.desktop.PlaneStarTest"
project.ext.mainClassName = "io.oz.wnw.norm.desktop.BasicTweenTest"
project.ext.assetsDir = new File("../android/assets")
task run(dependsOn: classes, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
}
task debug(dependsOn: classes, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
debug = true
}
task dist(type: Jar) {
manifest {
attributes 'Main-Class': project.mainClassName
}
from {
configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
with jar
}
dist.dependsOn classes
The other two tests commented out above can run both in CLI and eclipse, which don't depend on the local published package. Any idea?
--------- parent project/build.gradle ----------
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
// jcenter()
google()
}
dependencies {
classpath 'org.wisepersist:gwt-gradle-plugin:1.0.9'
classpath 'com.android.tools.build:gradle:7.0.0-alpha08'
}
}
allprojects {
version = '1.0'
ext {
appName = "wn cloud"
gdxVersion = '1.9.14'
gltfVersion = '0.1.0-SNAPSHOT'
roboVMVersion = '2.3.8'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0'
}
repositories {
mavenLocal()
maven { url "http://maven.aliyun.com/nexus/content/groups/public" }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
mavenCentral()
// jcenter()
google()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
project(":desktop") {
apply plugin: "java-library"
dependencies {
implementation project(":core")
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
}
}
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
implementation project(":core")
api "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
}
}
project(":html") {
apply plugin: "java-library"
apply plugin: "gwt"
apply plugin: "war"
dependencies {
implementation project(":core")
api "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
api "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
api "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
api "com.badlogicgames.ashley:ashley:$ashleyVersion:sources"
}
}
project(":core") {
apply plugin: "java-library"
apply plugin: 'eclipse'
eclipse {
classpath {
downloadSources=true
downloadJavadoc = true
}
}
dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
api "com.badlogicgames.ashley:ashley:$ashleyVersion"
api 'io.github.odys-z:gdx-gltf:0.1.0-SNAPSHOT'
}
}
I faced the same problem. Turns out that LibGDX works with JDK 7 and any version compiled above won't work.
You need to enforce java to compile at version 1.7 before publishing locally
apply plugin: 'java'
sourceCompatibility = 1.7
targetCompatibility = 1.7
i'm trying to get the war file from Jhipster project project using this command
./gradlew -Pprod -Pwar clean bootWar
this the error that i got
FAILURE: Build failed with an exception.
What went wrong:
Task 'bootWar' not found in root project 'account'. Some candidates are: 'bootRun'.
Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 0s
this my bild.gradle
import org.gradle.internal.os.OperatingSystem
buildscript {
repositories {
mavenLocal()
jcenter()
maven { url "https://repo.spring.io/plugins-release" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${spring_boot_version}"
classpath "io.spring.gradle:propdeps-plugin:0.0.9.RELEASE"
classpath "gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:1.4.17"
//jhipster-needle-gradle-buildscript-dependency - JHipster will add additional gradle build script plugins here
}
}
plugins {
id "org.sonarqube" version "2.5"
id "net.ltgt.apt-eclipse" version "0.13"
id "net.ltgt.apt-idea" version "0.13"
id "net.ltgt.apt" version "0.13"
id "io.spring.dependency-management" version "1.0.3.RELEASE"
//jhipster-needle-gradle-plugins - JHipster will add additional gradle plugins here
}
apply plugin: 'java'
sourceCompatibility=1.8
targetCompatibility=1.8
tasks.withType(JavaExec) {
jvmArgs = [ '-Xmx512m','-Xms256m']
}
// Until JHipster supports JDK 9
assert System.properties['java.specification.version'] == '1.8'
apply plugin: 'maven'
apply plugin: 'org.springframework.boot'
apply plugin: 'war'
apply plugin: 'propdeps'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'idea'
dependencyManagement {
imports {
mavenBom 'io.github.jhipster:jhipster-dependencies:' + jhipster_dependencies_version
//jhipster-needle-gradle-dependency-management - JHipster will add additional dependencies management here
}
}
defaultTasks 'bootRun'
group = 'com.skywriter.account'
version = '0.0.1-SNAPSHOT'
description = ''
bootRepackage {
mainClass = 'com.skywriter.account.AccountApp'
}
war {
}
springBoot {
mainClass = 'com.skywriter.account.AccountApp'
executable = true
buildInfo()
}
if (OperatingSystem.current().isWindows()) {
task pathingJar(type: Jar) {
dependsOn configurations.runtime
appendix = 'pathing'
doFirst {
manifest {
attributes 'Class-Path': configurations.runtime.files.collect {
it.toURI().toURL().toString().replaceFirst(/file:\/+/, '/').replaceAll(' ', '%20')
}.join(' ')
}
}
}
bootRun {
addResources = false
dependsOn pathingJar
doFirst {
classpath = files("$buildDir/classes/java/main", "$buildDir/resources/main", pathingJar.archivePath)
}
}
} else {
bootRun {
addResources = false
}
}
test {
exclude '**/CucumberTest*'
// uncomment if the tests reports are not generated
// see https://github.com/jhipster/generator-jhipster/pull/2771 and https://github.com/jhipster/generator-jhipster/pull/4484
// ignoreFailures true
reports.html.enabled = false
}
task cucumberTest(type: Test) {
description = "Execute cucumber BDD tests."
group = "verification"
include '**/CucumberTest*'
// uncomment if the tests reports are not generated
// see https://github.com/jhipster/generator-jhipster/pull/2771 and https://github.com/jhipster/generator-jhipster/pull/4484
// ignoreFailures true
reports.html.enabled = false
}
check.dependsOn cucumberTest
task testReport(type: TestReport) {
destinationDir = file("$buildDir/reports/tests")
reportOn test
}
task cucumberTestReport(type: TestReport) {
destinationDir = file("$buildDir/reports/tests")
reportOn cucumberTest
}
apply from: 'gradle/docker.gradle'
apply from: 'gradle/sonar.gradle'
apply from: 'gradle/liquibase.gradle'
apply from: 'gradle/mapstruct.gradle'
//jhipster-needle-gradle-apply-from - JHipster will add additional gradle scripts to be applied here
if (project.hasProperty('prod')) {
apply from: 'gradle/profile_prod.gradle'
}
if (project.hasProperty('stage')) {
apply from: 'gradle/profile_stage.gradle'
}
if (project.hasProperty('demo')) {
apply from: 'gradle/profile_demo.gradle'
}
if (project.hasProperty('aws')) {
apply from: 'gradle/profile_aws.gradle'
}
if (project.hasProperty('devtest')) {
apply from: 'gradle/profile_devtest.gradle'
}
if (project.hasProperty('aws')) {
apply from: 'gradle/profile_aws.gradle'
}
else {
apply from: 'gradle/profile_dev.gradle'
}
if (project.hasProperty('graphite')) {
apply from: 'gradle/graphite.gradle'
}
if (project.hasProperty('prometheus')) {
apply from: 'gradle/prometheus.gradle'
}
if (project.hasProperty('zipkin')) {
apply from: 'gradle/zipkin.gradle'
}
configurations {
providedRuntime
compile.exclude module: "spring-boot-starter-tomcat"
}
repositories {
mavenLocal()
jcenter()
}
dependencies {
compile 'io.logz.logback:logzio-logback-appender:v1.0.21'
compile "org.springframework.boot:spring-boot-starter-cache"
compile "io.github.jhipster:jhipster"
compile "io.dropwizard.metrics:metrics-core"
compile "io.dropwizard.metrics:metrics-json"
compile "io.dropwizard.metrics:metrics-jvm"
compile "io.dropwizard.metrics:metrics-servlet"
compile "io.dropwizard.metrics:metrics-servlets"
compile "net.logstash.logback:logstash-logback-encoder"
compile "com.fasterxml.jackson.datatype:jackson-datatype-json-org"
compile "com.fasterxml.jackson.datatype:jackson-datatype-hppc"
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310"
compile "com.fasterxml.jackson.datatype:jackson-datatype-hibernate5"
compile "com.fasterxml.jackson.core:jackson-annotations"
compile "com.fasterxml.jackson.core:jackson-databind"
compile "com.fasterxml.jackson.module:jackson-module-afterburner"
compile "com.ryantenney.metrics:metrics-spring"
compile "com.hazelcast:hazelcast"
compile "com.hazelcast:hazelcast-hibernate52"
compile "com.hazelcast:hazelcast-spring"
compile "javax.cache:cache-api"
compile "org.hibernate:hibernate-core"
compile "com.zaxxer:HikariCP"
compile "org.apache.commons:commons-lang3"
compile "commons-io:commons-io"
compile "javax.transaction:javax.transaction-api"
compile "org.hibernate:hibernate-entitymanager"
compile "org.hibernate:hibernate-envers"
compile "org.hibernate:hibernate-validator"
compile "org.liquibase:liquibase-core"
compile "com.mattbertolini:liquibase-slf4j"
compile "org.springframework.boot:spring-boot-actuator"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.springframework.boot:spring-boot-loader-tools"
compile "org.springframework.boot:spring-boot-starter-mail"
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-starter-aop"
compile "org.springframework.boot:spring-boot-starter-data-jpa"
compile "org.springframework.boot:spring-boot-starter-security"
compile ("org.springframework.boot:spring-boot-starter-web") {
exclude module: 'spring-boot-starter-tomcat'
}
compile "org.springframework.boot:spring-boot-starter-undertow"
compile "org.springframework.boot:spring-boot-starter-thymeleaf"
compile "org.zalando:problem-spring-web"
compile "org.springframework.cloud:spring-cloud-starter"
compile "org.springframework.cloud:spring-cloud-starter-ribbon"
compile "org.springframework.cloud:spring-cloud-starter-hystrix"
compile "org.springframework.cloud:spring-cloud-starter-spectator"
compile "org.springframework.retry:spring-retry"
compile "org.springframework.cloud:spring-cloud-starter-eureka"
compile "org.springframework.cloud:spring-cloud-starter-config"
compile "org.springframework.cloud:spring-cloud-security"
compile "org.springframework.cloud:spring-cloud-starter-feign"
compile "org.springframework.cloud:spring-cloud-spring-service-connector"
compile "org.springframework:spring-context-support"
compile "org.springframework.security:spring-security-config"
compile "org.springframework.security:spring-security-data"
compile "org.springframework.security:spring-security-web"
compile "org.springframework.security.oauth:spring-security-oauth2"
compile "org.springframework.security:spring-security-jwt"
compile ("io.springfox:springfox-swagger2") {
exclude module: 'mapstruct'
}
compile "io.springfox:springfox-bean-validators"
compile "org.postgresql:postgresql"
compile "org.mapstruct:mapstruct-jdk8:${mapstruct_version}"
testCompile "com.jayway.jsonpath:json-path"
testCompile "info.cukes:cucumber-junit"
testCompile "info.cukes:cucumber-spring"
testCompile ("org.springframework.boot:spring-boot-starter-test") {
exclude group: 'com.vaadin.external.google', module: 'android-json'
}
testCompile "org.springframework.security:spring-security-test"
testCompile "org.springframework.boot:spring-boot-test"
testCompile "org.assertj:assertj-core"
testCompile "junit:junit"
testCompile "org.mockito:mockito-core"
testCompile "com.mattbertolini:liquibase-slf4j"
testCompile "org.hamcrest:hamcrest-library"
testCompile "com.h2database:h2"
optional ("org.springframework.boot:spring-boot-configuration-processor") {
exclude group: 'com.vaadin.external.google', module: 'android-json'
}
//jhipster-needle-gradle-dependency - JHipster will add additional dependencies here
}
task cleanResources(type: Delete) {
delete 'build/resources'
}
task wrapper(type: Wrapper) {
gradleVersion = '4.4'
}
task stage(dependsOn: 'bootRepackage') {
}
compileJava.dependsOn processResources
processResources.dependsOn cleanResources,bootBuildInfo
bootBuildInfo.mustRunAfter cleanResources
thanks in advance
To make the answer more visible (valid for jhipster 4.x):
for creating a war that can be deployed in an application server use ./gradlew war and for an executable war file, which can be executed via java -jar use ./gradlew bootWar.
I'm trying to build a Springboot web application that creates a WAR and also a suite of tests using the Spock framework but every time I try to run gradle build the console will execute the tests but will not create the web app WAR although it mentions a file in the web app source code saying a deprecation warning so I know it is at least doing something with it. Is there some kind of configuration I'm missing from my build.gradle or concept about how sourceSets work? I can compile the web app fine and the tests when I do them separately with their own build.gradle files but I was hoping that the code below could build the WAR and execute the tests in the same file.
plugins {
id 'java'
id 'maven-publish'
id 'war'
id 'groovy'
}
repositories {
mavenLocal()
maven {
url = 'https://repo.spring.io/libs-release'
}
maven {
url = 'http://repo.maven.apache.org/maven2'
}
}
sourceSets{
main {
java { srcDir "src\\TestingWebAppSpringBoot\\src\\main\\java" }
resources {srcDir "src\\TestingWebAppSpringBoot\\src\\main\\resources" }
groovy { srcDirs = [] }
}
test{
groovy {
srcDirs = ["src\\test_pack\\com\\example\\diag\\test\\spock\\main", "src\\test_pack\\com\\example\\diag\\test\\spock\\test" ]
}
}
}
test{
reports.html.destination = file("build\\spockTestResults")
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter-thymeleaf:2.0.0.RELEASE'
compile 'org.springframework.boot:spring-boot-starter-web:2.0.0.RELEASE'
compile 'org.springframework.boot:spring-boot-starter-security:2.0.0.RELEASE'
compile 'org.codehaus.groovy:groovy-all:2.4.14'
providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
testCompile (
fileTree(dir: 'build\\server\\_archives\\_release', include: '*.jar'),
fileTree(dir: 'build\\common\\_archives\\_release', include: '*.jar'),
'net.sourceforge.htmlunit:htmlunit:2.26',
"org.codehaus.groovy:groovy-all:2.4.5",
"org.spockframework:spock-core:1.0-groovy-2.4"
)
}
group = 'com.something.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
I am trying to create implement client-server communication with the help of grpc
proto file -
syntax="proto3";
package com.project.grpc.roleservice;
message UserRequest {
string userName=1;
}
message RoleReply {
string userRole=1;
}
service UserRoleFromServer{
rpc getRoleUser(stream UserRequest) returns (stream RoleReply);
}
Gradle build -
buildscript {
ext {
springBootVersion = '2.0.4.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("com.google.protobuf:protobuf-gradle-plugin:0.8.5")
}
}
plugins {
id 'java'
}
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.google.protobuf'
group 'com.project.grpc.roleservice'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.5.1-1"
}
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.16.1'
}
}
generateProtoTasks {
all()*.plugins {
grpc {}
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-web')
compile( 'io.grpc:grpc-netty-shaded:1.16.1')
compile('io.grpc:grpc-protobuf:1.16.1')
compile('io.grpc:grpc-stub:1.16.1')
compile 'io.github.lognet:grpc-spring-boot-starter:3.0.0'
runtime('org.springframework.boot:spring-boot-devtools')
runtime('mysql:mysql-connector-java')
testCompile (group: 'junit', name: 'junit', version: '4.12')
}
After building the project all the files are generated in a build folder and a UserRoleFromServerGrpc is generated which I want to extend and implement in my server-service file
But The UserRoleFromServerGrpc has a lot of errors it asks for following dependencies
Streamobserver needs io.grpc:grpc-stub:1.16.1 ,grpc-core
Add io.grpc:grpc-stub:1.16.1 to classpath
but I have already defined these dependencies in gradle build
How to resolve this issue
Screenshot of IDE
I am trying to use mapstruct generated classes on a new spring-boot project(personal), and it seems my build script requires something else.
The classes are being generated correctly cause I can see them(java and class files in the build folder) and when the application is executed from the jar file, it actually works.
The problem is that when it is executed from eclipse STS, it says spring cant find the generated clases, and yes I made sure, they are created using #Component, and are in the ComponentScanPath.
build.gradle
buildscript {
ext {
springBootVersion = '1.1.6.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
ext {
javaLanguageLevel = '1.8'
generatedMapperSourcesDir = "${buildDir}/generated-src/mapstruct/main"
}
configurations {
mapstruct
}
sourceSets.main {
ext.originalJavaSrcDirs = java.srcDirs
java.srcDir "${generatedMapperSourcesDir}"
}
jar {
baseName = 'MtgGrimoire'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-aop")
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-websocket")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
compile("org.springframework.boot:spring-boot-starter-ws")
compile('org.postgresql:postgresql:9.3-1102-jdbc41')
compile( 'org.mapstruct:mapstruct:1.0.0.Beta1' )
compile fileTree(dir: 'libs', include: ['*.jar'])
mapstruct( 'org.mapstruct:mapstruct-processor:1.0.0.Beta1' )
testCompile("org.springframework.boot:spring-boot-starter-test")
}
eclipse {
classpath {
containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
}
}
task wrapper(type: Wrapper) {
gradleVersion = '1.12'
}
task generateMainMapperClasses(type: JavaCompile) {
ext.aptDumpDir = file( "${buildDir}/tmp/apt/mapstruct" )
destinationDir = aptDumpDir
classpath = compileJava.classpath + configurations.mapstruct
source = sourceSets.main.originalJavaSrcDirs
ext.sourceDestDir = file ( "$generatedMapperSourcesDir" )
options.define(
compilerArgs: [
"-nowarn",
"-proc:only",
"-encoding", "UTF-8",
"-processor", "org.mapstruct.ap.MappingProcessor",
"-s", sourceDestDir.absolutePath,
"-source", rootProject.javaLanguageLevel,
"-target", rootProject.javaLanguageLevel,
]
);
inputs.dir source
outputs.dir generatedMapperSourcesDir;
doFirst {
sourceDestDir.mkdirs()
}
doLast {
aptDumpDir.delete()
}
}
compileJava.dependsOn generateMainMapperClasses
Also it seems it isn't generated inside the project bin folder