`

Maven配置jetty和tomcat部署方式

 
阅读更多
Tomcat: http://tomcat.apache.org/maven-plugin-2.1/
pom.xml
<pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.tomcat.maven</groupId>
          <artifactId>tomcat6-maven-plugin</artifactId>
          <version>2.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.tomcat.maven</groupId>
          <artifactId>tomcat7-maven-plugin</artifactId>
          <version>2.1</version>
        </plugin>
      </plugins>
    </pluginManagement>
 
settings.xml
<pluginGroups>
    ....
    <pluginGroup>org.apache.tomcat.maven</pluginGroup>
    ....
  </pluginGroups>
 命令: tomcat:run


jetty: http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin
pom.xml
<plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>maven-jetty-plugin</artifactId>
        <version>6.1.10</version>
        <configuration>
          <stopPort>9966</stopPort>
          <stopKey>foo</stopKey>
        </configuration>
</plugin>
 或者
<plugin>
				<groupId>org.mortbay.jetty</groupId>
				<artifactId>maven-jetty-plugin</artifactId>
				<version>6.1.20</version>
				<configuration>
					<contextPath>/jbpm5</contextPath>
					<!--<webDefaultXml>webdefault.xml</webDefaultXml> -->
					<scanIntervalSeconds>0</scanIntervalSeconds>
					<scanTargetPatterns>
						<scanTargetPattern>
							<directory>src/main/webapp/WEB-INF</directory>
							<excludes>
								<exclude>**/*.jsp</exclude>
							</excludes>
							<includes>
								<include>**/*.properties</include>
								<include>**/*.xml</include>
							</includes>
						</scanTargetPattern>
					</scanTargetPatterns>
				</configuration>
			</plugin>
 setting.xml
<profile>
  ...
  <pluginGroups>
    <pluginGroup>org.mortbay.jetty</pluginGroup>
  </pluginGroups>
</profile>
 命令: jetty:run

部署方式
1. 参考 http://www.cnblogs.com/fnng/archive/2011/12/16/2290587.html
2. 点击工具条的小虫子,然后选择Debug config(调试配置), 或者点击项目右键,Debug as(调试方式)-->选择Debug config(调试配置),选择Maven Build, 然后点右上角创建一个配置,在Goals输入:jetty:run, 这里可以使用多个命令,比如:clean jetty:run。然后点击debug(调试),开始以Debug方式运行工程。下次运行的时候,不用配置,右键或者点工具栏那里的debug,会多出刚才的这个配置,然后直接运行。
3.使用server(服务器) of eclipse的方式运行。参考: http://blog.csdn.net/laoshuisheng/article/details/6420003

注意:第2种方式,在包含多Module的时候,很难对代码进行调试,这种情况最好使用的3种。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics