myeclipse下web项目转maven,并保留WEB.XML
2015-11-04 16:17
260 查看
Myeclipse 2014 maven31,直接右键项目-configure----convert to maven project..2,剪切走在maven不必要的工作目录如webroot并放入src/main/webappsrc/main/webapp当然这个目录可以自己生成的。webapp下文件会自动发布到tomcat项目根目录,有需要直接新建,如WEB-INF3,将java代码放入main/java路径后,选择项目Properties->Java buildpath->source,设置output folder至target下的classes文件夹,需要新建。4.Properties->myeclipse->Deployment Assembly下注意remove webroot,且检查是否有maven依赖,没有的话可以close一下项目再打开。note:于src下的prop文件用以下方法获得:本类.class.getResourceAsStream("/“+”src之下路径“);附上maven pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion><groupId>BugService</groupId><artifactId>BugService</artifactId><version>0.0.1-SNAPSHOT</version><packaging>war</packaging><name>BugService</name><dependencies><dependency><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>3.0.1</version><scope>provided</scope></dependency><dependency><groupId>javax</groupId><artifactId>javaee-web-api</artifactId><version>6.0</version><scope>provided</scope></dependency></dependencies><build><pluginManagement><plugins><plugin><artifactId>maven-compiler-plugin</artifactId><version>3.1</version><configuration><source>1.7</source><target>1.7</target></configuration></plugin><plugin><artifactId>maven-war-plugin</artifactId><version>2.3</version><configuration><warSourceDirectory>WebRoot</warSourceDirectory><failOnMissingWebXml>false</failOnMissingWebXml></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>2.3</version><configuration><failOnMissingWebXml>false</failOnMissingWebXml></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-dependency-plugin</artifactId><version>2.6</version><executions><execution><phase>validate</phase><goals><goal>copy</goal></goals><configuration><outputDirectory>${endorsed.dir}</outputDirectory><silent>true</silent><artifactItems><artifactItem><groupId>javax</groupId><artifactId>javaee-endorsed-api</artifactId><version>7.0</version><type>jar</type></artifactItem></artifactItems></configuration></execution></executions></plugin></plugins></pluginManagement></build></project>
相关文章推荐
- java clone()
- 探究JAVA父类子类静态代码块、静态变量、构造方法的执行顺序
- Struts2+Spring3+Hibernate框架技术
- Java 执行过程详解 - JVM 生命周期
- Java导出Excel三表头
- springmvc 返回汉字乱码
- 两种Eclipse部署动态web项目方法
- JDK安装与配置详细图文教程
- spring mvc 返回页面json数据一种做法
- 传智播客javase总结
- Java 并发编程实践---可重入锁
- Eclipse常用快捷键
- Java简单的客户端与服务器的建立与通信
- Java语法糖---伪泛型
- 【已解决】Eclipse for Android 出现Could not find SDK folder....问题解决
- Java图形用户界面——Swing概述
- 在java 中 cmd.startsWith("") 是什么意思
- [Gradle] 在 Eclipse 下利用 gradle 构建系统
- 如何使用javadoc
- Java提高篇