【问题标题】:Unable to cf push the Spring Boot 2.6.1 app, giving zip: not a valid zip fileUnable to cf push the Spring Boot 2.6.1 app,给 zip: not a valid zip file
【发布时间】:2021-12-24 17:46:42
【问题描述】:

我用 Gradle 创建了一个简单的 Spring Boot App (2.6.1)。

创建了一个在本地运行良好的端点。

但是,当我尝试使用 cf pushcommand 将其发布到 pcf 时,它给出了 zip: not a valid zip file 错误。

我正在使用以下清单文件

---
applications:
  - timeout: 180
    name: SpringLatest
    instances: 1
    memory: 1G
    disk_quota: 1G
    health-check-type: port
    path: /build/libs/SpringLatest-1.0.0-LOCAL.jar
    buildpacks:
    - https://github.com/cloudfoundry/java-buildpack.git
    env:
      SPRING_PROFILES_ACTIVE: dev
      APP_ENVIRONMENT: dev
      JBP_CONFIG_OPEN_JDK_JRE: '{jre: { version: 11.0.7_10 }}'
      JBP_LOG_LEVEL: DEBUG
      CF_HEALTH_CHECK_TIMEOUT: 1200
      JAVA_OPTS: -Xms512M -Xmx512M

【问题讨论】:

标签: java spring-boot cloud-foundry


【解决方案1】:

在使用 Maven 从 Spring boot 版本 2.5.X 升级到 2.6.X 以进行依赖管理时遇到同样的问题。通过在 maven 插件执行中排除 repackage 目标解决了这个错误。

    <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <executions>
            <execution>
                <goals>
                    <goal>repackage</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

【讨论】:

    猜你喜欢
    • 2021-06-01
    • 1970-01-01
    • 2018-09-04
    • 2022-12-26
    • 1970-01-01
    • 1970-01-01
    • 2020-02-09
    • 1970-01-01
    • 2018-03-24
    相关资源
    最近更新 更多