--如何使用Eclipse创建Maven项目
https://jingyan.baidu.com/article/c85b7a644ba689003bac9509.html
--图解maven项目的创建和maven项目的结构
https://jingyan.baidu.com/article/63f236285286200208ab3d08.html
--利用maven的resources、filter和profile实现不同环境使用不同配置文件
https://blog.csdn.net/hdchenyue/article/details/51540215
--Eclipse上Maven环境配置使用 (全)
http://www.cnblogs.com/tangshengwei/p/6341462.html
<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>com.abc.java</groupId> <artifactId>coressm</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <!-- build #s --> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <!-- 对丢失web.xml检测机制进行忽略, Dynamic Web Module 3.0 工程时代不需要web.xml文件注册相关内容的,所以工程默认不生成web.xml。--> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.2</version> <executions> <execution> <id>default-compile</id> <phase>compile</phase> <goals> <goal>compile</goal> </goals> </execution> </executions> <configuration> <!-- 使用jdk1.7时使用该配置,如果要使用jdk1.8,则下面2行要修改为1.8 --> <source>1.7</source> <target>1.7</target> <encoding>UTF-8</encoding> </configuration> </plugin> </plugins> </build> <!-- build #e --> </project>
mvn命令打war包(包括源码jar包)
pom.xml中如果没有指定打包类型,默认打包类型为jar
1、确保pom.xml里面引入了:
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-war-plugin --> <dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>3.0.0</version> </dependency>
2、确保项目引入的是jdk,而不是jre;
3、确保项目不报错的情况下,依次执行mvn clean--> mvn package;
或者项目右击run -->mvn clean-->mvn build...-->Goals文本框处输入"package";
4、如果项目出现感叹号,很可能是build path里面的Maven Dependencies里面有出现missing的jar,可以找到jar对应的本地仓库的路径,将对应的版本号里面的.lastUpdated文件删除,都删除后,再项目右击-->maven -->Update Project.
参考:
http://www.blogjava.net/qileilove/articles/410887.html
http://blog.csdn.net/kaku21/article/details/50060637