pom 文件插件
<build> <plugins> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <path>/</path> <!--项目访问路径。当前配置的访问是localhost:9090/, 如果配置是/aa,则访问路径为localhost:9090/aa --> <port>9090</port> <uriEncoding>UTF-8</uriEncoding><!-- 非必需项 --> </configuration> </plugin> </plugins> </build>
运行 :mvn tomcat7:run
打包:mvn package -Pdevelop -Dmaven.skip.test=true tomcat7:deploy
<build> <plugins> <plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>9.2.2.v20140723</version> <configuration> <httpConnector> <port>8080</port> <host>localhost</host> </httpConnector> <scanIntervalSeconds>1</scanIntervalSeconds> </configuration> </plugin> </plugins> </build> 运行: jetty:run
<!-- 指定maven编译的jdk版本,如果不指定,maven3默认用jdk 1.5 maven2默认用jdk1.3 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> </configuration> </plugin>