从基础父 pom 继承 Spring 启动依赖项导致我的应用程序的 cf push 命令失败
Inheriting Spring Boot dependencies from a base parent pom is causing the cf push command to fail for my application
我的 Spring 引导应用程序的 pom.xml 非常小。我的父标记指向我的公共 pom 应用程序,而公共 pom 包含我所有的 Spring 启动依赖项。我可以清理、编译、打包和 运行 我的应用程序而不会出现任何错误,但是当我尝试 运行 cf push 时,出现以下错误:
[ERR] [Buildpack] ERROR Finalize failed with exception #<RuntimeError: No container can run this application. Please ensure that you've pushed a valid JVM artifact or artifacts using the -p command line argument or path manifest entry. Information about valid JVM artifacts can be found at https://github.com/cloudfoundry/java-buildpack#additional-documentation.
我正在查看 cf java-buildpack 的文档,我的应用程序似乎未能通过 spring 引导容器检测。是否需要将某些内容添加到应用程序的 pom 文件中,以便 buildpack 将其识别为有效的 spring 启动应用程序?
一般情况下的操作顺序应如下所示
Assemble待推送神器
mvn clean package
在你的项目目录下
推神器
cf push yourAppName -p target/your-hello-world-1.0.0-SNAPSHOT.jar
同目录下
忘记指定工件是
疑难解答
如果你期待 Spring Boot Container to pick up the artifact, make sure your artifact (that is your-hello-world-1.0.0-SNAPSHOT.jar
) contains the Spring Boot jar - lib/spring-boot-.*.jar
, as this is detection criteria. And if you use Spring Boot Maven plugin, make sure it has repackage goal is in place as described here
如果还是不行或者你想要更多的配置Tomcat Container to handle your artifact - change packaging to war or even switch to deployable war
问题的发生是因为 spring-boot-maven-plugin。重新打包解决了我的问题。
https://docs.spring.io/spring-boot/docs/current/maven-plugin/usage.html
我的 Spring 引导应用程序的 pom.xml 非常小。我的父标记指向我的公共 pom 应用程序,而公共 pom 包含我所有的 Spring 启动依赖项。我可以清理、编译、打包和 运行 我的应用程序而不会出现任何错误,但是当我尝试 运行 cf push 时,出现以下错误:
[ERR] [Buildpack] ERROR Finalize failed with exception #<RuntimeError: No container can run this application. Please ensure that you've pushed a valid JVM artifact or artifacts using the -p command line argument or path manifest entry. Information about valid JVM artifacts can be found at https://github.com/cloudfoundry/java-buildpack#additional-documentation.
我正在查看 cf java-buildpack 的文档,我的应用程序似乎未能通过 spring 引导容器检测。是否需要将某些内容添加到应用程序的 pom 文件中,以便 buildpack 将其识别为有效的 spring 启动应用程序?
一般情况下的操作顺序应如下所示
Assemble待推送神器
mvn clean package
在你的项目目录下推神器
cf push yourAppName -p target/your-hello-world-1.0.0-SNAPSHOT.jar
同目录下
忘记指定工件是
疑难解答
如果你期待 Spring Boot Container to pick up the artifact, make sure your artifact (that is
your-hello-world-1.0.0-SNAPSHOT.jar
) contains the Spring Boot jar -lib/spring-boot-.*.jar
, as this is detection criteria. And if you use Spring Boot Maven plugin, make sure it has repackage goal is in place as described here如果还是不行或者你想要更多的配置Tomcat Container to handle your artifact - change packaging to war or even switch to deployable war
问题的发生是因为 spring-boot-maven-plugin。重新打包解决了我的问题。
https://docs.spring.io/spring-boot/docs/current/maven-plugin/usage.html