Home>

When I tried to deploy SpringBoot project to heroku,
The Gradle task fails with an error.
I would like to know how to make a successful deployment.

remote: * What went wrong:
remote: A problem was found with the configuration of task':compileJava' (type'JavaCompile').
remote: >Directory'/tmp/build_c643e295524ad9596513afb8960e51b5/build/tmp/doma-resources' specified for property'$1' does not exist.
source code:(build.gradle)
plugins {
    id'org.springframework.boot' version '2.3.1.RELEASE'
    id'io.spring.dependency-management' version '1.0.9.RELEASE'
    id'java'
}
group ='com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
// define the temporary directory path
ext.domaResourcesDir = "${buildDir}/tmp/doma-resources"
// Extract the resources referenced by doma for annotation processing to a temporary directory
task extractDomaResources(type: Copy, dependsOn: processResources) {
    from processResources.destinationDir
    include'doma.compile.config'
    include'META-INF/**/*.sql'
    include'META-INF/**/*.script'
    into domaResourcesDir
}
// Copy the resources in the temporary directory to the output directory of the compileJava task
task copyDomaResources(type: Copy, dependsOn: extractDomaResources) {
    from domaResourcesDir
    into compileJava.destinationDir
}
compileJava {
   // Depend on the above task
   dependsOn copyDomaResources
   // Set the temporary directory to the input directory of the compileJava task
   inputs.dir domaResourcesDir
   options.encoding ='UTF-8'
}
repositories {
    mavenCentral()
    maven {url'https://oss.sonatype.org/content/repositories/snapshots/'}
}
dependencies {
    implementation'org.springframework.boot:spring-boot-starter-thymeleaf'
    implementation'org.springframework.boot:spring-boot-starter-web'
    developmentOnly'org.springframework.boot:spring-boot-devtools'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group:'org.junit.vintage', module:'junit-vintage-engine'
    }
    runtimeOnly'org.postgresql:postgresql'
    implementation'org.seasar.doma.boot:doma-spring-boot-starter:1.1.1'
    annotationProcessor'org.seasar.doma:doma:2.19.2'
    implementation'org.seasar.doma:doma:2.19.2'
}
test {
    useJUnitPlatform()
}
What I tried
git add.
git commit -m "comment"
git push heroku master
Supplemental information (FW/tool ​​version, etc.)

Java8
SpringBoot2.3.1
Gradle3

I am using Doma2 and referred to the following URL.
https://doma.readthedocs.io/en/2.20.0/build/#gradle

  • Answer # 1

    Recently, we recommend using the org.seasar.doma.compile plugin to build projects using Doma. What if I try it with the following build.gradle with this plugin enabled?

    plugins {
        id'org.springframework.boot' version '2.3.1.RELEASE'
        id'io.spring.dependency-management' version '1.0.9.RELEASE'
        id'java'
        id'org.seasar.doma.compile' version '1.1.0'
    }
    group ='com.example'
    version = '0.0.1-SNAPSHOT'
    sourceCompatibility = '1.8'
    compileJava {
       options.encoding ='UTF-8'
    }
    repositories {
        mavenCentral()
        maven {url'https://oss.sonatype.org/content/repositories/snapshots/'}
    }
    dependencies {
        implementation'org.springframework.boot:spring-boot-starter-thymeleaf'
        implementation'org.springframework.boot:spring-boot-starter-web'
        developmentOnly'org.springframework.boot:spring-boot-devtools'
        testImplementation('org.springframework.boot:spring-boot-starter-test') {
            exclude group:'org.junit.vintage', module:'junit-vintage-engine'
        }
        runtimeOnly'org.postgresql:postgresql'
        implementation'org.seasar.doma.boot:doma-spring-boot-starter:1.1.1'
        annotationProcessor'org.seasar.doma:doma:2.19.2'
        implementation'org.seasar.doma:doma:2.19.2'
    }
    test {
        useJUnitPlatform()
    }

  • Answer # 2

    Please note that the version of Doma that you are using is different, but please also refer to the project below.
    https://github.com/domaframework/simple-examples