`
kong0itey
  • 浏览: 299044 次
社区版块
存档分类
最新评论

如何在myeclipse中使用maven?

    博客分类:
  • java
 
阅读更多
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按钮。

注意必须先启动tomcat,再部署maven项目。
D:\tomcat\apache-tomcat-6.0.35\webapps\manager必须保留
分享到:
评论
2 楼 中岛嘉兰 2015-05-07  
新建maven项目那能详细点吗
1 楼 331008019 2012-11-28  
非常好,照着弄了一下,成功了,嘿嘿

相关推荐

Global site tag (gtag.js) - Google Analytics