Gradle应用引擎插件未反映对.java文件所做的更改

d8tt03nd  于 2023-11-18  发布在  Java
关注(0)|答案(1)|浏览(125)

我有一个spring应用程序,我使用应用引擎gradle插件来运行运行和部署应用程序。我看到前端(jsp)的变化得到反映,即使不必重新启动服务器。但java类的变化没有反映,即使重新启动和删除构建文件夹。可能是什么问题?这是我的build.gradle文件

buildscript {
  repositories {
    mavenCentral()
  }

  dependencies {
    classpath 'com.google.cloud.tools:appengine-gradle-plugin:2.4.4'
  }
}

apply plugin: 'com.google.cloud.tools.appengine-appenginewebxml'

ext.getAppVersion = { ->
    return project.property('version')
}

appengine {
    tools {
        cloudSdkVersion = '449.0.0'
    }
    run {
        // ./gradlew appengineStart (to run the app locally)
        // ./gradlew appengineStop
        jvmFlags = ["-Dappengine.fullscan.seconds=5"]
        projectId= 'xxxx'
        services = '../war'
        port = 8080
        automaticRestart = true
    }
}

//  ./gradlew deploy -Pversion=version_name
task deploy {
    doLast {
        def versionName = getAppVersion()
        exec {
            commandLine 'gcloud', 'app', 'deploy', '--quiet', '../war/WEB-INF/appengine-web.xml', '--version=' + versionName, '--no-promote'
        }
    }
}

explodeWar {
    with copySpec {
        from '../war/WEB-INF/appengine-web.xml'
        into 'WEB-INF'
    }
}

字符串
甚至尝试了这里提到的调试模式,但没有运气

dgtucam1

dgtucam11#

您可以使用Gradle for App Engine插件检查以下配置:

build.gradle文件应该如下所示:

buildscript {      // Configuration for building
  repositories {
    jcenter()      // Bintray's repository - a fast Maven Central mirror & more
    mavenCentral()
  }
  dependencies {
    classpath 'com.google.cloud.tools:appengine-gradle-plugin:2.5.0'
    classpath 'org.akhikhl.gretty:gretty:+'
  }
}

repositories {   // repositories for Jar's you access in your code
  jcenter()
  mavenCentral()
}

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'org.akhikhl.gretty'
apply plugin: 'com.google.cloud.tools.appengine'

dependencies {
  providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
  providedCompile 'com.google.appengine:appengine:+'
// Add your dependencies here.

}

gretty {
    servletContainer = 'jetty9'  // What App Engine Flexible uses
}

  appengine {
    deploy {   // deploy configuration
      stopPreviousVersion = true  // default - stop the current version
      promote = true              // default - & make this the current version
    }
  }

group = 'com.example.appengine'   // Generated output GroupId
version = '1.0-SNAPSHOT'          // Version in generated output

sourceCompatibility = 1.8
targetCompatibility = 1.8

字符串
根据您的App Engine环境(标准或灵活)仔细遵循这些步骤。
如果上述步骤不起作用,您可以通过他们的Github for GAE Gradle plugin提交问题。

相关问题