1、maven命令:
mvn clean 清除编译临时文件
mvn install 发布到本地资源库指令
mvn compile 编译
mvn package 打包
mvn -Pfastinstall 快速导入架包,不导入test等
mvn eclipse:eclipse 一般从svn上拉下maven工程后,在相应工程路径下执行此命令,然后导入eclipse即可
下面的命令是把下载的架包导入到本地仓库,默认位置在${user.dir}/.m2/repository:
mvn install:install-file -Dfile=C:\Users\12071142\Desktop\cxf-rt-management-web.jar -DgroupId=org.apache.cxf -DartifactId=cxf-rt-management-web -Dversion=2.7.3 -Dpackaging=jar
2、maven 概念知识:
maven安装路径下的 settings相当于全局变量,.m2中的settings相当于局部变量,所以一般只要修改.m2中的settings配置即可。
groupId和artifactId唯一确定一个架包。
3、settings.xml的基本格式:
<settings 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/settings-1.0.0.xsd"> <localRepository/> <interactiveMode/> <usePluginRegistry/> <offline/> <pluginGroups/> <servers/> <mirrors/> <proxies/> <profiles/> <activeProfiles/> </settings>
详细说明:http://www.cnblogs.com/wuchangming/articles/2974298.html
4、实践区
a、建maven web :参考 http://blog.csdn.net/micwing/article/details/7554148
b、启动spring 项目是 报错:找不到已有的类,一般都是这个问题!!!!!
严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
原因:猜测是maven没有把spring的包映射到 web-inf/lib 下面
解决方案:http://www.cnblogs.com/zhouyalei/archive/2011/11/30/2268606.html
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
花边知识:
CIL :command-line interface命令行窗口