Maven管理hera

一、在eclipse中安装Maven的插件 (http://www.eclipse.org/downloads/)

二、修改eclipse的一些配置,以支持maven web项目的部署和启动 

       1、修改eclipse.ini文件,在-vmargs选项前面添加(注意分两行,并且不能在路径前面添加空格) 

 

-vm
C:\Program Files\Java\jdk1.6.0_38\bin\javaw.exe


 

        2、设置eclipse的jdk路径 【Installed JREs信息】

           Window -> Preferences -> Java -> Installed JREs 点击"Add"按钮,选择默认的"Standard VM", 点击"Next >", 点击"JRE home"右边的"Directory"选择文件C:\Program Files\Java\jdb1.6.0_38\jre。一直“确定”,回到"Installed JREs"界面,在刚添加的"jre6"打上勾。

        3、选择目录树中的Installed JREs -> Execution Environments", 点选界面左侧的"J2SE-1.5",然后在右侧点选"jdk1.6", JavaSE-1.6也相同设置

       4、将新版jdk指定为默认 java-> compiler中将compiler compliace level 设置为6.0

       5、添加tomcat服务, server -> Runtime Enviroment -> Add

       6、http://blog.csdn.net/jinxinxin1314/article/details/4433134

       7、下载 http://tomcat.heanet.ie/native/1.1.2/binaries/win32/tcnative-1.dll, 然后复制到C:\windows\system32下面

       注:以上过程还可以解决“Unable to locate the Javac Compiler in”、“Missing artifact com.sun:tools:jar:1.5.0“问题

 

三、创建Web项目

         参见:http://blog.csdn.net/quincylk/article/details/8510968

 

四、项目配置

      参见:http://blog.csdn.net/micwing/article/details/7554148

         1、为项目添加src/main/java、  src/test/java、 src/test/recource 目录

         2、给项目添加Facets功能,如图(特别要注意路径的设置)

                    

         3、设置项目部署程序集

 

 

五、一些xml的编写

      pom.xml

4.0.0com.hera.appHerawar0.0.1-SNAPSHOTHera Maven Webapphttp://maven.apache.orgjunitjunit3.8.1testcommons-loggingcommons-logging-api1.1 org.mod4j.org.eclipse.xtextlog4j1.2.15org.springframeworkspring-beans3.0.5.RELEASEorg.springframeworkspring-core3.0.5.RELEASEorg.springframeworkspring-context3.0.5.RELEASEorg.springframeworkspring-web3.0.5.RELEASEruntimeorg.springframeworkspring-jdbc3.0.5.RELEASEorg.springframeworkspring-dao2.0.8org.springframework.ormorg.springframework.orm3.0.5.RELEASEorg.springframeworkspring-tx3.0.5.RELEASEorg.springframeworkspring-asm3.0.5.RELEASEorg.springframeworkspring-aop3.0.5.RELEASEorg.springframeworkspring-expression3.0.5.RELEASEorg.apache.strutsstruts2-core2.2.3.1org.apache.strutsstruts2-json-plugin2.2.3.1org.apache.strutsstruts2-config-browser-plugin2.2.3.1javax.servletservlet-api2.5providedjavax.servlet.jspjsp-api2.1providedorg.apache.strutsstruts2-spring-plugin2.2.3.1c3p0c3p00.9.1.2commons-dbcpcommons-dbcp1.4commons-poolcommons-pool1.5.6mysql-connector-javamysql-connector-java5.1.22org.mybatismybatis3.0.6org.mybatismybatis-spring1.0.2xercesxmlParserAPIs2.6.2dom4jdom4j1.6.1com.google.code.gsongson2.1net.sf.json-lib json-lib2.4jdk15Heracompileorg.apache.maven.pluginsmaven-compiler-plugin1.61.6	

六、通过tomcat部署

     参见:http://www.cnblogs.com/cbf4life/archive/2010/01/29/1659502.html

        1、配置tomcat,增加用户和权限 (其他的maven web项目可以共用)

       2、修改maven的setting.xml,为服务增加对应的配置(每个maven web项目都要添加)

       3、在项目的pom.xml中增加配置 (添加在plugins中)

       org.codehaus.mojotomcat-maven-plugin1.0-beta-1http://localhost:8080/managerHera


 

       4、启动tomcat (这一步不能忘记,否由执行第5步会出现connect 失败)

       5、在项目的Run as中配置命令 package tomcat:redeploy,之后执行,会生成一个war包,并部署到tomcat对应的目录下

       6、停止tomcat (前面启动是为了通过manager生成war)

       7、Run as => Run on server启动项目,当然也可以直接再次重新启动tomcat

 

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
  http://maven.apache.org/xsd/settings-1.0.0.xsd" >
     E:/EclipseJeeWorkspace/maven/repository
 
   
    nexus-snapshots
    deployment
    deployment
   

   
   
    Hera
    admin
    password
   

 

 
   
    nexus
    internal nexus repository
    http://121.199.27.193:8081/nexus/content/groups/public/
    *
   

 

 

注:http://www.itivy.com/java/archive/2012/3/17/634675819914772496.html (打印SQL语句,UTF-8问题)

 

注:mybatis 自动生成代码工具 http://blog.csdn.net/kkdelta/article/details/7228177     http://blog.csdn.net/fu9958/article/details/7521681 

http://www.jpriv.net/technology/jetty-in-eclipse.html   eclipse run on jetty


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部