我有一个spring boot gradle项目,我正在eclipse中开发并推送到云存储库。我配置了一个云构建触发器来启动gradle构建并部署到应用程序引擎(标准)。根据构建日志,每个步骤都成功,但是当我点击URL时,我得到了404,不知道为什么。
当我从笔记本电脑上进行gradle appengineDeploy部署时,我可以将其部署到App Engine,然后启动服务。这使我相信我的cloudbuild.yaml文件不正确。
cloudbuild.yaml
steps:
- name: 'gcr.io/cloud-builders/gradle'
args: ['build']
- name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'deploy', 'src/main/webapp/WEB-INF/appengine-web.xml']
timeout: '1600s'
src / main / webapp / WEB-INF / appengine-web.xml
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>my_project_id</application>
<version>1</version>
<threadsafe>true</threadsafe>
<runtime>java8</runtime>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/classes/logging.properties"/>
</system-properties>
</appengine-web-app>
build.gradle
buildscript {
ext {
springBootVersion = '2.0.6.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.+'
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.google.cloud.tools.appengine'
apply plugin: 'war'
group = 'my-group'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compileOnly('javax.servlet:javax.servlet-api:3.1.0')
compileOnly('org.slf4j:jul-to-slf4j')
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
implementation('org.springframework.cloud:spring-cloud-gcp-starter-sql-mysql:1.0.0.RELEASE')
implementation('org.springframework.boot:spring-boot-starter-web') {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
}
implementation('com.google.appengine:appengine-api-1.0-sdk:+')
}
buildlog
Step #0: BUILD SUCCESSFUL in 53s
Step #0: 4 actionable tasks: 4 executed
Finished Step #0
Starting Step #1
Step #1: Already have image (with digest): gcr.io/cloud-builders/gcloud
Step #1: Services to deploy:
Step #1:
Step #1: descriptor: [/workspace/src/main/webapp/WEB-INF/appengine-web.xml]
Step #1: source: [/workspace/src/main/webapp]
Step #1: target project: [dev-poc-220521]
Step #1: target service: [default]
Step #1: target version: [20181111t040050]
Step #1: target url: [https://dev-poc-220521.appspot.com]
Step #1:
Step #1:
Step #1: Do you want to continue (Y/n)?
Step #1: Beginning deployment of service [default]...
Step #1: #============================================================#
Step #1: #= Uploading 5 files to Google Cloud Storage =#
Step #1: #============================================================#
Step #1: File upload done.
Step #1: Updating service [default]...
Step #1: .......................................................done.
Step #1: Setting traffic split for service [default]...
Step #1: ........done.
Step #1: Deployed service [default] to [https://dev-poc-220521.appspot.com]
Step #1:
Step #1: You can stream logs from the command line by running:
Step #1: $ gcloud app logs tail -s default
Step #1:
Step #1: To view your application in the web browser run:
Step #1: $ gcloud app browse --project=dev-poc-220521
Finished Step #1
答案 0 :(得分:0)
您是否在server.port=<some_port_number>
的{{1}}中检查端口设置?我遇到了同样的问题,当我删除自定义端口号时,它可以按预期工作。