0

The pom.xml for my Spring Boot application is very minimal. My parent tag is pointed to my common pom application and the common pom is what holds all of my Spring Boot dependencies. I can clean, compile, package, and run my application without any errors, but when I try to run cf push, i get the following error:

[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.

I was looking at the documentation for the cf java-buildpack and it seems like my application is failing the spring boot container detection. Is there something I need to add to my application's pom file so that the buildpack recognizes it as a valid spring boot application?

jaerme
  • 13
  • 3

2 Answers2

0

You general-case sequence of actions should look like the following

  1. Assemble artifact to be pushed

    mvn clean package under your project directory

  2. Push the artifact

    cf push yourAppName -p target/your-hello-world-1.0.0-SNAPSHOT.jar under same directory

Forgetting specifying the artifact is typical pitfall for beginners

  1. Troubleshoot

    • if you are expecting 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

    • if still no luck or you want more configurable Tomcat Container to handle your artifact - change packaging to war or even switch to deployable war

Kostiantyn
  • 1,856
  • 11
  • 13
  • I am specifying the path in my manifest file, so that's definitely not the issue. I'm wondering if my artifact doesn't contain the lib/spring-boot-.*.jar because it's inheriting it from a parent pom. – jaerme Aug 22 '18 at 22:59
  • 1
    Do you still have this plugin configuration with repackage goal in your pom? https://docs.spring.io/spring-boot/docs/current/maven-plugin/usage.html – Kostiantyn Aug 22 '18 at 23:08
0

The problem was happening because of spring-boot-maven-plugin. Repackage solved my problem.

https://docs.spring.io/spring-boot/docs/current/maven-plugin/usage.html

Sam
  • 452
  • 5
  • 15