如何在myeclipse中使用maven

如题所述

1、下载maven,解压到D盘maven文件夹下,即D:\maven\apache-maven-3.0.4。 2、在D:\maven目录下新建repository文件夹,即D:\maven\repository。 3、下载tomcat6,解压到D盘tomcat目录下,即D:\tomcat\apache-tomcat-6.0.35。 4、在myeclipse中找到Window->Preferences->MyEclipse->Maven4MyEclipse->Installations ,点Add添加路径D:\maven\apache-maven-3.0.4。 5、在上面步骤的界面中找到open file链接,打开maven配置文件。 加入设置<localRepository>D:\maven\repository</localRepository> 加入设置 <server> <id>tomcat</id> <username>admin</username> <password>密码</password> </server> 。 6、在myeclipse中找到Window->Preferences->MyEclipse->Servers->Tomcat->Tomcat 6.x ,选择Tomcat home directoy为D:\tomcat\apache-tomcat-6.0.35 7、到修改D:\tomcat\apache-tomcat-6.0.35\conf\tomcat-users.xml加入设置 <user username="admin" password="123123" roles="manager"/> 8、在myeclipse里新建maven项目lowca,在pom.xml中加入设置
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifactId> <version>1.1</version> <configuration> <url>http://localhost:8080/manager/html</url> <server>tomcat</server> <path>/lowca</path> </configuration> </plugin>9、启动tomcat 10、右键点击项目lowca,选择Run As->Maven build,在弹出的窗口的Goals文本框中输入 package tomcat:redeploy,然后点击Run按钮。
温馨提示:答案为网友推荐,仅供参考
相似回答