简体   繁体   中英

Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain when deploy maven project to app engine gg cloud with cicd

i deployed maven project demo to app engine gg cloud with cicd and this is error build log gg app:

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)

this is pom.xml -

4.0.0 org.springframework.boot spring-boot-starter-parent 2.3.5.RELEASE com.example.simple_project demo 0.0.1-SNAPSHOT demo Demo project for 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>

this is.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"

I already have a directory.mvn/wrapper in the project root project

/workspace/.mvn/wrapper/maven-wrapper.properties: No such file

The error indicates that Maven is trying to open the file maven-wrapper.properties , however it is not found. Please confirm that the file is there.

You may want to take a look to https://stackoverflow.com/a/50105966/6003934

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM