首页 > 代码库 > maven拓展——eclipse中运行maven项目

maven拓展——eclipse中运行maven项目

首先,在pom.xml中配置插件:

<build>      <plugins>               <plugin>                <groupId>org.apache.tomcat.maven</groupId>                <artifactId>tomcat7-maven-plugin</artifactId>                <version>2.1</version>                <configuration>                    <port>8080</port>                    <path>/ssm-crud</path>                    <uriEncoding>UTF-8</uriEncoding>                    <finalName>ssm-crud</finalName>                    <server>tomcat7</server>                </configuration>            </plugin>    </plugins>    </build>  

在eclipse中配置maven插件(见另外一篇博客):

  选择pom.xml文件——>右键——>选择 Run As——> Maven build ...

    几个常用的maven命令:

 

命令描述
tomcat:deploy部署一个web war包
tomcat:reload重新加载web war包

tomcat:start

启动tomcat

tomcat:stop

停止tomcat

tomcat:undeploy

停止一个war包
tomcat:run启动嵌入式tomcat ,并运行当前项目

    在这里要注意一下,该插件命名方式有些不同,比如启动tomcat ,对应的目标命令是: tomcat7:run ,同样,其它命令也是这样,需要更改为:tomcat7:<插件执行点>

    技术分享

  //maven在网络不稳定时会产生一些奇怪的问题,解决方案是删掉重新下载!

 

maven拓展——eclipse中运行maven项目