使用Tomcat,那么以下方法将很不错:
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.0</version> <executions> <execution> <id>tomcat-run</id> <goals> <goal>exec-war-only</goal> </goals> <phase>package</phase> <configuration> <path>/standalone</path> <enableNaming>false</enableNaming> <finalName>standalone.jar</finalName> <charset>utf-8</charset> </configuration> </execution> </executions></plugin>
这将创建一个名为“ standalone.jar”的uberjar,然后你只需调用即可
java -jar standalone.jar
这将在http:// localhost:8080 / standalone上启动应用程序
选择备用端口很容易
java -jar standalone.jar -httpPort=7070



