当执行mvn -U clean package -Prelease -Dmaven.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
解决方案1:命令中的参数用单引号包起来
mvn -U clean package ‘-Prelease -Dmaven.test.skip=true’
继续报错
如下
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:09 h
[INFO] Finished at: 2020-05-07T13:04:49+08:00
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "release -Dmaven.test.skip=true" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M2:enforce (banned-jsr305) on project hbase-client: Some Enforcer rules have failed.
Look above for specific messages explaining why the rule failed. -> [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/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :hbase-client
添加跳过enforcer参数,如下
mvn package -DskipTests validate -Denforcer.skip=true
继续报错
Error:connection reset
卡在hbase-client模块,分析应该是网络问题
继续从hbase-client模块进行编译
mvn package -DskipTests validate -Denforcer.skip=true -rf hbase-client
又报错!!
[ERROR] Failed to execute goal on project hbase-client: Could not resolve
dependencies for project org.apache.hbase:hbase-client:jar:2.1.6.3.1.5.1-
2: Could not transfer artifact org.apache.hbase:hbase-
protocol:jar:2.1.6.3.1.5.1-2 from/to jetty
(http://repo.hortonworks.com/content/groups/public/): GET request of:
org/apache/hbase/hbase-protocol/2.1.6.3.1.5.1-2/hbase-protocol-
2.1.6.3.1.5.1-2.jar from jetty failed: Premature end of Content-Length
delimited message body (expected: 3221641; received: 492129 -> [Help 1]
分析,应该还是网络问题
继续从hbase-client模块进行编译
mvn package -DskipTests validate -Denforcer.skip=true -rf hbase-client
过程中断了,晚上挂起来执行算了
touch ../mvnLog
nohup mvn package -DskipTests validate -Denforcer.skip=true >../mvnLog 2>&1 &
编译成功!
但是没有看到tar包!!!
查找mvn操作手册
重新编译,发现正常情况应该在habse-assembly文件目录下有tar.gz包
重新编译
nohup mvn package -DskipTests assembly:single validate -Denforcer.skip=true >../mvnLog 2>&1 &
编译成功,在habse-assembly目录下也有tar包了
ok,结束