mvn -v 查看maven版本 mvn compile 编译 mvn test 测试 mvn package 打包 mvn clean 清除target mvn install 安装jar包到本地仓库中
mvn eclipse:eclipse 生成eclipse项目
快速生成新项目框架 1:mvn archetype:generate 按照提示进行选择 2:mvn archetype:gennerate -DgroupId=组织名(公司网址反写+项目名) -DartifactId=项目名-模块 -Dversion=版本号 -Dpackage=代码所存在的包名
镜像仓库 maven\conf\settings.xml修改mirror
<mirror> <id>maven.net.cn</id> <mirrorOf>central</mirrorOf> <name>central mirror in china</name> <url>http://maven.net.cn/content/groups/public</url> </mirror>修改本地仓库位置
<localRepository> D:\coding\apache-maven-3.3.9\repository </localRepository>更改maven工程默认jdk
<profile> <id>jdk-1.8</id> <activation> <activeByDefault>true</activeByDefault> <jdk>1.8</jdk> </activation> <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> </properties> </profile>完整的项目构建过程: 清理、编译、测试、打包、集成测试、验证、部署
maven的生命周期:每一步都要将前面的所有步骤执行
clean 清理项目 pre-clean 执行清理前的工作 clean 清理上一次构建生成的所有文件 post-clean 执行清理后的文件 default 构建项目(核心) compile test package install site 生成项目站点 pre-site 在生成项目站点前要完成的工作 site 生成项目的站点文档 post-site 在生成项目站点后要完成的工作 site-deploy 发布生成的站点到服务器上