Maven中的org.codehaus.mojo的tomcat配置

  • maven构建web项目的时候用tomcat做container的时候,我们可以在maven中配置

  • “老的”插件官网:http://mojo.codehaus.org/tomcat-maven-plugin/index.html,当然这个插件被apache搞过去了,新的:http://tomcat.apache.org/maven-plugin.html。稍微看了下apache的tomcat6/7配置方法,觉得还是老的适合,够用就行了,反正只是个小插件。

  •  

    <build>
    		<finalName>test-mvc</finalName>
    		<plugins>
    			<plugin>
    				<groupId>org.codehaus.mojo</groupId>
    				<artifactId>tomcat-maven-plugin</artifactId>
    				<!-- 这是因为我local resp的原因 -->
    				<!-- <version>1.2-SNAPSHOT</version> -->  
    				<configuration>
    					<url>http://www.mydomain.com</url>
    					<!--<path>${project.build.finalName}</path>-->  
    					<path>/mypath</path>
    					<port>80</port>
    					<uriEncoding>utf-8</uriEncoding>
    					<systemProperties>
                                              <!--<JAVA_OPTS>-Xms128m -Xmx512m -XX:MaxPermSize=256m</JAVA_OPTS>-->
                                              <JAVA_OPTS>-Xms128m -Xmx512m</JAVA_OPTS>
                                            </systemProperties>
    				</configuration>
    			</plugin>
    		</plugins>
    	</build>

     

  • Since version 2.0-beta-1 tomcat mojos has been renamed to tomcat6 and tomcat7 with the same goals.

    You must configure your pom to use this new groupId:

    <plugins>
    
            <plugin>
              <groupId>org.apache.tomcat.maven</groupId>
              <artifactId>tomcat6-maven-plugin</artifactId>
              <version>2.2</version> 
              <configuration>
                        <url>http://websocket.demo.cc</url>
                        <port>80</port>
                        <path>/</path>
                        <uriEncoding>utf-8</uriEncoding>
                        <systemProperties>
                            <!--<JAVA_OPTS>-Xms128m -Xmx512m -XX:MaxPermSize=256m</JAVA_OPTS>-->
                            <JAVA_OPTS>-Xms128m -Xmx512m</JAVA_OPTS>
                        </systemProperties>
                    </configuration>
            </plugin>
    
            <plugin>
              <groupId>org.apache.tomcat.maven</groupId>
              <artifactId>tomcat7-maven-plugin</artifactId>
              <version>2.2</version>
              <configuration>
                        <url>http://websocket.demo.cc</url>
                        <port>80</port>
                        <path>/</path>
                        <uriEncoding>utf-8</uriEncoding>
                        <systemProperties>
                            <!--<JAVA_OPTS>-Xms128m -Xmx512m -XX:MaxPermSize=256m</JAVA_OPTS>-->
                            <JAVA_OPTS>-Xms128m -Xmx512m</JAVA_OPTS>
                        </systemProperties>
                    </configuration>
            </plugin>
    
    </plugins>

     

  • <!-- Maven Jetty Plugin -->
                <plugin>
                    <groupId>org.mortbay.jetty</groupId>
                    <artifactId>maven-jetty-plugin</artifactId>
                    <version>6.1.10</version>
                    <configuration>
                        <contextPath>/</contextPath>
                        <!--<webApp>${project.build.directory}/${project.artifactId}-${project.version}.war</webApp>-->
                        <connectors>
                            <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                                <port>80</port>
                            </connector>
                        </connectors>
                        <!-- 每2秒的间隔扫描一次,实现热部署 -->
                        <!--<scanIntervalSeconds>2</scanIntervalSeconds>-->
                        <stopPort>9966</stopPort>
                        <stopKey>stopKey</stopKey>
                    </configuration>
                </plugin>
  • 插件代码贴出来没什么好说的了,一看就懂了,方便查询。其他一些什么多个容器。。什么的goals自己去查阅两个官方的文档即可

  • 插件org.codehaus.mojo:                                            http://mojo.codehaus.org/tomcat-maven-plugin/index.html

  • 插件org.apache.tomcat.maven: http://tomcat.apache.org/maven-plugin.html

你可能感兴趣的:(maven,tomcat)