通过 maven 启动 tomcat, jetty
配置maven
直接在pom
里面添加一个plugin
节点就行
<build> <plugins> <plugin> ... </plugin> </plugins> </build>
需要变更版本只需要修改version
即可
Tomcat 6
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat6-maven-plugin</artifactId> <version>2.0</version> <configuration> <path>/</path> <port>8080</port> <uriEncoding>UTF-8</uriEncoding> </configuration> </plugin>
Tomcat 7
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.0</version> <configuration> <path>/</path> <port>8080</port> <uriEncoding>UTF-8</uriEncoding> </configuration> </plugin>
jetty 老的配置
<plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>6.1.26</version> <configuration> <connectors> <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> <port>8080</port> </connector> </connectors> <contextPath>/</contextPath> <scanIntervalSeconds>10</scanIntervalSeconds> </configuration> </plugin>
jetty 新的配置
<plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>8.1.8.v20121106</version> <configuration> <connectors> <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector"> <port>8080</port> </connector> </connectors> <systemProperties> <systemProperty> <name>org.eclipse.jetty.util.URI.charset</name> <value>UTF-8</value> </systemProperty> </systemProperties> </configuration> </plugin>
blog comments powered by Disqus
发布日期
2012-12-08