1、下载: http://maven.apache.org/download.cgi
2、配置 D:\software\apache-maven-3.2.5\conf\settings.xml 里面可修改本地存放jar的仓库地址、拿jar的服务器镜像地址、
3、常用命令:
Maven 安装 JAR 包的命令是:
mvn install:install-file -Dfile=jar包的位置 -DgroupId=上面的groupId -DartifactId=上面的artifactId -Dversion=上面的version -Dpackaging=jar
例如:
mvn install:install-file -Dfile=C:\Users\Administrator\Desktop\jsqlparser-0.9.1.jar -DgroupId=net.sf.jsqlparser -DartifactId=jsqlparser -Dversion=0.9.1 -Dpackaging=jar
mvn install:install-file -Dfile=C:\Users\Administrator\Desktop\\ueditor\jsp\lib\json.jar -DgroupId=org.json -DartifactId=orgjson -Dversion=1.0 -Dpackaging=jar
mvn install:install-file -Dfile=C:\Users\Administrator\Desktop\\ueditor\jsp\lib\\ueditor-1.1.2.jar -DgroupId=baidu.ueditor -DartifactId=ueditor -Dversion=1.1.2 -Dpackaging=jar
导入后,在项目pom.xml添加依赖即可
cmd命令清理:
cd切换至项目 pom.xml 目录下:
maven clean
maven install
$ mvn test
$ mvn test -Dmaven.test.failure.ignore=true
$ mvn install -Dmaven.test.skip=true
$ mvn compile
4、项目构建讲解:
groupId 团体,公司,小组,组织,项目,或者其它团体。团体标识的约定是,它以创建这个项目的组织名称的 逆向域名(reverse domain name)开头。来自Sonatype的项目有一个以com.sonatype开头的 groupId ,而Apache Software的项目有以org.apache开头的 groupId 。
artifactId 在 groupId 下的表示一个单独项目的唯一标识符。
version 一个项目的特定版本。发布的项目有一个固定的版本标识来指向该项目的某一个特定的版本。而正在开发中的项目可以用一个特殊的标识,这种标识给版本加上一个“SNAPSHOT”的标记。
packaging 项目的类型,默认是 jar ,描述了项目打包后的输出。类型为 jar 的项目产生一个JAR文件,类型为 war 的项目产生一个web应用。
5、pom配置
配置 Jetty 插件(tomact类似)
[...]
[...]
$ mvn jetty:run
閱讀更多 碼農筆記Day 的文章