Is there a way to have a single Spring Boot project be packagable into both JAR and WAR without changing the pom.xml
or the application source?
I\'ve re
I managed to do it by adding
${packaging.type}
to the POM file and then setting different profiles for JAR and WAR:
jar
jar
war
war
org.springframework.boot
spring-boot-starter-tomcat
provided
Now mvn package -P war
produces a WAR and mvn package -P jar
produces a JAR.
Another option is to create separate modules for JAR and WAR, but I didn't go that route.