未找到Grails 3和Heroku阶段任务

未找到Grails 3和Heroku阶段任务,grails,heroku,gradle,Grails,Heroku,Gradle,我正在尝试将我一直在开发的Grails3应用程序部署到Heroku,但我认为build.gradle文件存在问题 以下命令在本地工作: ./gradlew stage heroku local web 然后,我可以在 部署的第一部分显示它执行我的阶段任务。但后来,它抱怨找不到stage任务 remote: -----> Gradle app detected remote: -----> Installing OpenJDK 1.8... done remote: ----->

我正在尝试将我一直在开发的Grails3应用程序部署到Heroku,但我认为build.gradle文件存在问题

以下命令在本地工作:

./gradlew stage
heroku local web
然后,我可以在

部署的第一部分显示它执行我的阶段任务。但后来,它抱怨找不到stage任务

remote: -----> Gradle app detected
remote: -----> Installing OpenJDK 1.8... done
remote: -----> Building Gradle app...
remote:        WARNING: The Gradle buildpack is currently in Beta.
remote: -----> executing ./gradlew stage
remote:        Downloading https://services.gradle.org/distributions/gradle-2.13-all.zip
我在部署期间收到以下错误:

remote:  !     ERROR: Failed to run Gradle!
remote:        It looks like your project does not contain a 'stage' task, which Heroku needs in order
remote:        to build your app. Our Dev Center article on preparing a Gradle application for Heroku
remote:        describes how to create this task:
remote:        https://devcenter.heroku.com/articles/deploying-gradle-apps-on-heroku
remote:        
remote:        If you're stilling having trouble, please submit a ticket so we can help:
remote:        https://help.heroku.com
remote:        
remote:        Thanks,
remote:        Heroku
remote: 
remote:  !     Push rejected, failed to compile Gradle app.
但是,我已经按照中的说明进行了操作,并将阶段任务添加到了build.gradle中,并填充了一个procfile

当我在项目根目录中运行./gradlew任务时,阶段任务确实显示在“其他任务”下的列表中

这是我的身材。格雷德尔:

buildscript {
    ext {
        grailsVersion = project.grailsVersion
    }
    repositories {
        mavenLocal()
        maven { url "https://repo.grails.org/grails/core" }
    }
    dependencies {
        classpath "org.grails:grails-gradle-plugin:$grailsVersion"
        classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.8.2"
        classpath "org.grails.plugins:hibernate4:5.0.10"
    }
}

version "0.1"
group "paxdata"

apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"war"
apply plugin:"org.grails.grails-web"
apply plugin:"org.grails.grails-gsp"
apply plugin:"asset-pipeline"

ext {
    grailsVersion = project.grailsVersion
    gradleWrapperVersion = project.gradleWrapperVersion
}

repositories {
    mavenLocal()
    maven { url "https://repo.grails.org/grails/core" }
}

dependencyManagement {
    imports {
        mavenBom "org.grails:grails-bom:$grailsVersion"
    }
    applyMavenExclusions false
}

dependencies {
    compile group: 'org.codehaus.groovy.modules.http-builder', name: 'http-builder', version: '0.6'
    compile 'org.grails.plugins:spring-security-core:3.1.1'
    compile 'org.grails.plugins:quartz:2.0.9'
    compile "org.springframework.boot:spring-boot-starter-logging"
    compile "org.springframework.boot:spring-boot-autoconfigure"
    compile "org.grails:grails-core"
    compile "org.springframework.boot:spring-boot-starter-actuator"
    compile "org.springframework.boot:spring-boot-starter-tomcat"
    compile "org.grails:grails-dependencies"
    compile "org.grails:grails-web-boot"
    compile "org.grails.plugins:cache"
    compile "org.grails.plugins:scaffolding"
    compile "org.grails.plugins:hibernate4"
    compile "org.hibernate:hibernate-ehcache"
    console "org.grails:grails-console"
    profile "org.grails.profiles:web"
    runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.8.2"
    runtime "com.h2database:h2"
    testCompile "org.grails:grails-plugin-testing"
    testCompile "org.grails.plugins:geb"
    testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1"
    testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"
    compile 'com.github.jsimone:webapp-runner:8.0.30.2'
}

assets {
    minifyJs = true
    minifyCss = true
}

task wrapper(type: Wrapper) {
    gradleVersion = gradleWrapperVersion
}

task stage() {
    dependsOn clean, war
}
tasks.stage.doLast() {
    delete fileTree(dir: "build/distributions")
    delete fileTree(dir: "build/assetCompile")
    delete fileTree(dir: "build/distributions")
    delete fileTree(dir: "build/libs", exclude: "*.war")
}
war.mustRunAfter clean

task copyToLib(type: Copy) {
    into "$buildDir/server"
    from(configurations.compile) {
        include "webapp-runner*"
    }
}

stage.dependsOn(copyToLib)
这是我的Procfile的内容:

web: cd build ; java $JAVA_OPTS -Dgrails.env=prod -jar ../build/server/webapp-runner-*.jar --expand-war --port $PORT libs/*.war

关于我做错了什么有什么想法吗?

我也有同样的问题,通过运行以下命令解决了


heroku config:set GRADLE_TASK=“build”
git推送heroku主机

您可以查看以下链接

https://devcenter.heroku.com/articles/deploying-gradle-apps-on-heroku

我正在构建一个没有测试的jar:
build-x test

// build.gradle.kts

tasks.jar {
    manifest {
        attributes(mapOf("Main-Class" to application.mainClass))
    }
    from(configurations.runtimeClasspath.get().map { f -> if (f.isDirectory) f else zipTree(f) })
    archiveFileName.set("cats-app.jar")
}

因此,
git-push-heroku-master
在使用后工作: heroku config:set GRADLE_TASK=“build-x test”


我也遇到了同样的问题,我最终做的是直接在仪表板上更改配置()。在Deploy选项卡中,默认情况下使用的部署方法是Heroku Git,因此我将其更改为Github。我知道这不是正确的解决方案,但至少现在起作用了。
// build.gradle.kts

tasks.jar {
    manifest {
        attributes(mapOf("Main-Class" to application.mainClass))
    }
    from(configurations.runtimeClasspath.get().map { f -> if (f.isDirectory) f else zipTree(f) })
    archiveFileName.set("cats-app.jar")
}