-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Enable support for executable WAR files in the executable-jar buildpack by allowing .war files specified via BP_EXECUTABLE_JAR_LOCATION to be treated as valid runnable JVM packages.
Describe the Enhancement
The executable-jar buildpack currently does not recognize a .war file specified via the BP_EXECUTABLE_JAR_LOCATION environment variable as a valid JVM application package, even when the WAR is fully executable (i.e., runnable via java -jar). This behavior unnecessarily limits support for Spring Boot WARs, which are explicitly designed to be executable and self-contained.
Executable WARs are a first-class citizen in the Spring Boot ecosystem, using a Main-Class such as org.springframework.boot.loader.WarLauncher. Users should be able to point to a .war file using BP_EXECUTABLE_JAR_LOCATION and have it work identically to .jar files.
Motivation
Spring Boot enables users to package applications as executable WARs, combining the benefits of WAR-based servlet configuration and modern containerization:
- WARs maintain compatibility with traditional application servers and CI/CD pipelines.
- Executable WARs support standalone execution (
java -jar app.war), using embedded servlet containers (Tomcat, Jetty, Undertow). - This format is especially useful in migration scenarios from legacy WAR deployments to containerized Spring Boot apps.
According to Spring Boot documentation, executable WARs are explicitly supported:
A Spring Boot WAR can be executed using
java -jar, and it will launch with an embedded servlet container.
Despite this, the executable-jar buildpack fails detection or execution if the file pointed to by BP_EXECUTABLE_JAR_LOCATION has a .war extension, even if it includes a valid Main-Class.
Expected Behavior
- The buildpack should recognize
.warfiles as valid targets ifBP_EXECUTABLE_JAR_LOCATIONis explicitly set. - Detection logic should validate the presence of
Main-Classand treat.warfiles equivalently to.jarfiles if the file is executable.
Possible Solution
- Extend the executable-jar buildpack logic to allow
.warfiles when:BP_EXECUTABLE_JAR_LOCATIONis set to a.warfileMain-Classis present and recognizable (e.g.,org.springframework.boot.loader.WarLauncher)
- Optionally, support an env variable like
BP_EXECUTABLE_WAR_LOCATION