Reputation: 33
I'm trying to run a war file how it's provided in documentation. I do:
$ ./gradlew -Pprod war
$ java -jar ./build/libs/jhipster-0.1-SNAPSHOT.war --spring.profiles.active=prod
no main manifest attribute, in ./build/libs/jhipster-0.1-SNAPSHOT.war
When I add Main-Class atribute to the war block:
war {
baseName = 'jhipster'
version = '0.1-SNAPSHOT'
manifest {
attributes 'Main-Class': 'com.jhipster.web.Application'
}
}
I get "Error: Could not find or load main class com.jhipster.web.Application"
It is said in spring-boot gradle plugin documentation http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#build-tool-plugins-gradle-packaging that it should find the Application class with main() method but somehow MANIFEST.MF contains only one line:
Manifest-Version: 1.0
What I do wrong?
Upvotes: 3
Views: 4437
Reputation: 116341
The war
task doesn't run Spring Boot's repackaging task so you're left with a traditional unexecutable war file that doesn't have a Main-Class
attribute in its manifest.
Try running build
or bootRepackage
instead:
$ ./gradlew -Pprod bootRepackage
Upvotes: 5