Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain when deploy maven project to app engine gg cloud with cicd
Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain when deploy maven project to app engine gg cloud with cicd
我使用 cicd 将 maven 项目演示部署到 App Engine gg 云,这是错误构建日志 gg 应用程序:
Step #6 - "builder": ./mvnw: 219: ./mvnw: cannot open
/workspace/.mvn/wrapper/maven-wrapper.properties: No such file
Step #6 - "builder": /workspace/.mvn/wrapper/maven-wrapper.jar: No such file or directory
Step #6 - "builder": Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
Step #6 - "builder": Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
Step #6 - "builder": Done "./mvnw clean package --batch-mode -DskipTests" (589.295636ms)
这是pom.xml-
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.3.5.RELEASE
com.example.simple_project
演示
0.0.1-快照
演示
Spring Boot
的演示项目
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
这是.gitlab-ci.yml
image: larsdroid/integratieproject1:v1
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay
SPRING_PROFILES_ACTIVE: gitlab-ci
stages:
- build
- package
- deploy
before_script:
- echo "Start CI/CD"
maven-build:
image: maven:3-jdk-11
stage: build
script:
- "mvn package -B"
artifacts:
paths:
- target/*.jar
deploy:
stage: deploy
script:
- gcloud auth activate-service-account --key-file $GOOGLE_SERVICE_ACCOUNT_FILE
- gcloud -q config set project ${GOOGLE_PROJECT_ID}
- gcloud app deploy app.yaml --quiet --project $GOOGLE_PROJECT_ID
only:
- master
after_script:
- echo "End CI/CD"
我在项目中已有一个目录.mvn/wrapper
root project
/workspace/.mvn/wrapper/maven-wrapper.properties: No such file
该错误表明 Maven 正在尝试打开文件 maven-wrapper.properties
,但未找到。请确认文件存在。
你可能想看看
我使用 cicd 将 maven 项目演示部署到 App Engine gg 云,这是错误构建日志 gg 应用程序:
Step #6 - "builder": ./mvnw: 219: ./mvnw: cannot open /workspace/.mvn/wrapper/maven-wrapper.properties: No such file Step #6 - "builder": /workspace/.mvn/wrapper/maven-wrapper.jar: No such file or directory Step #6 - "builder": Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain Step #6 - "builder": Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain Step #6 - "builder": Done "./mvnw clean package --batch-mode -DskipTests" (589.295636ms)
这是pom.xml-
4.0.0 org.springframework.boot spring-boot-starter-parent 2.3.5.RELEASE com.example.simple_project 演示 0.0.1-快照 演示 Spring Boot
的演示项目<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
这是.gitlab-ci.yml
image: larsdroid/integratieproject1:v1
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay
SPRING_PROFILES_ACTIVE: gitlab-ci
stages:
- build
- package
- deploy
before_script:
- echo "Start CI/CD"
maven-build:
image: maven:3-jdk-11
stage: build
script:
- "mvn package -B"
artifacts:
paths:
- target/*.jar
deploy:
stage: deploy
script:
- gcloud auth activate-service-account --key-file $GOOGLE_SERVICE_ACCOUNT_FILE
- gcloud -q config set project ${GOOGLE_PROJECT_ID}
- gcloud app deploy app.yaml --quiet --project $GOOGLE_PROJECT_ID
only:
- master
after_script:
- echo "End CI/CD"
我在项目中已有一个目录.mvn/wrapper root project
/workspace/.mvn/wrapper/maven-wrapper.properties: No such file
该错误表明 Maven 正在尝试打开文件 maven-wrapper.properties
,但未找到。请确认文件存在。
你可能想看看