Reputation: 308
I have an application built using maven
and spring mvc
and tomcat7-maven-plugin
. Can I package these to a jar file, so that i can run the jar file to start a tomcat server?
That means i don't need tomcat, only a jar file can provide a web service.
Upvotes: 2
Views: 4733
Reputation: 3400
Spring documentation is your friend. I am providing the links which you can follow, with highlighted parts in this post.
Once spring-boot-maven-plugin has been included in your pom.xml
it will automatically attempt to rewrite archives to make them executable using the spring-boot:repackage
goal. You should configure your project to build a jar or war (as appropriate) using the usual packaging element in the pom.xml
The main class that you want to launch can either be specified using a configuration option, or by adding a Main-Class
attribute to the manifest in the usual way.
To build and run a project artifact, you can type the following:
$ mvn package
$ java -jar target/mymodule-0.0.1-SNAPSHOT.jar
More information about the plugin is available here
Upvotes: 5