maven install 引入本地包异常问题处理
问题1:The goal you specified requires a project to execute but there is no POM in 错误
使用 mvn install 命令将本地包引入本地库时报错
mvn install:install-file -Dfile=C:\Users\xxx\Desktop\jar\common-encrypt-1.0-SNAPSHOT.jar -DgroupId=com.nari -DartifactId=sm-slf-shade -Dversion=1.0 -Dpackaging=jar
解决方法:该错误从字面意思来理解好像是找不到pom文件, 解决方法就是将相关参数加上引号,如下:
mvn install:install-file "-Dfile=C:\Users\xxx\Desktop\jar\common-encrypt-1.0-SNAPSHOT.jar" "-DgroupId=com.nari" "-DartifactId=sm-slf-shade" "-Dversion=1.0" "-Dpackaging=jar"
问题2:maven install 安装默认的 .m 目录
解决方法:增加本地库指定参数:"-Dmaven.repo.local=D:\maven\repository"
mvn install:install-file "-Dfile=C:\Users\xxx\Desktop\jar\common-encrypt-1.0-SNAPSHOT.jar" "-DgroupId=com.nari" "-DartifactId=sm-slf-shade" "-Dversion=1.0" "-Dpackaging=jar" "-Dmaven.repo.local=E:\mvnRespo\mvnRespo-aliyun-xm"
问题3:Unknown lifecycle phase “.test.skip=true“ 错误
我们在运行跳过单元测试时的命令mvn package -Dmaven.test.skip=true 时,出现Unknown lifecycle phase ".test.skip=true".如下
[ERROR] Unknown lifecycle phase ".test.skip=true". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException
-Dmaven.test.skip=true 没有被正确地识别,只需要在 '-Dmaven.test.skip=true' 加上单引号即可
mvn package '-Dmaven.test.skip=true'