我想知道是否有可能在制作包时获取maven使用的所有命令,或者在我使用时安装:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
我可以以某种方式获得使用过的命令列表吗? 可能有点像
mvn clean install
答案 0 :(得分:2)
我相信你最接近的是启用maven debug (-X
选项)并检查每个目标的详细输出,直到找出问题:
mvn package -X
由于您将获得大量[DEBUG]行,因此将此命令的输出重定向到文件(例如 out.log )会很有趣,因此您可以仔细检查其中的内容你最喜欢的文本编辑器:
mvn package -X > out.log
例如,检查下面编译目标生成的输出。您可以看到有关 javac编译的许多详细信息:
...
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-compiler-plugin:3.1:compile' with basic configurator -->
[DEBUG] (f) basedir = /home/you/yourproject/
[DEBUG] (f) buildDirectory = /home/you/yourproject/target
[DEBUG] (f) classpathElements = [/home/you/yourproject/target/classes, /h
[DEBUG] (f) compileSourceRoots = [/home/you/yourproject/src/main/java]
[DEBUG] (f) compilerId = javac
[DEBUG] (f) debug = true
[DEBUG] (f) encoding = UTF-8
[DEBUG] (f) failOnError = true
[DEBUG] (f) forceJavacCompilerUse = false
[DEBUG] (f) fork = false
[DEBUG] (f) generatedSourcesDirectory = /home/you/yourproject/target/gene
[DEBUG] (f) mojoExecution = org.apache.maven.plugins:maven-compiler-plugin:3.1:compile {execution: default-compil
[DEBUG] (f) optimize = false
[DEBUG] (f) outputDirectory = /home/you/yourproject/target/classes
[DEBUG] (f) projectArtifact = org.gov.serpro:pgddirf:jar:0.0.1-SNAPSHOT
[DEBUG] (f) showDeprecation = false
[DEBUG] (f) showWarnings = false
[DEBUG] (f) skipMultiThreadWarning = false
[DEBUG] (f) source = 1.7
[DEBUG] (f) staleMillis = 0
[DEBUG] (f) target = 1.7
[DEBUG] (f) useIncrementalCompilation = true
[DEBUG] (f) verbose = false
[DEBUG] (f) mavenSession = org.apache.maven.execution.MavenSession@71a27302
[DEBUG] (f) session = org.apache.maven.execution.MavenSession@71a27302
[DEBUG] -- end configuration --
[DEBUG] Using compiler 'javac'.
[DEBUG] Source directories: [/home/you/yourproject/src/main/java]
[DEBUG] Classpath: [/home/you/yourproject/target/classes
/home/you/.m2/repository/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar
/home/you/.m2/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar
/home/you/.m2/repository/javax/javaee-api/7.0/javaee-api-7.0.jar
...
我希望它能以某种方式帮助你!
答案 1 :(得分:1)
您可以使用Maven help:describe
目标
对于每个生命周期阶段,您可以知道是否附加了插件以及它执行的目标。
例如,在Maven WAR项目中,运行:
mvn help:describe -Dcmd=install
产生:
这是POM包装'战争'生命周期的一部分。这个 生命周期包括以下阶段:
验证:未定义
初始化:未定义
generate-sources:未定义
流程来源:未定义
generate-resources:未定义
process-resources:org.apache.maven.plugins:maven-resources-plugin:2.6:resources
compile:org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
流程类:未定义
generate-test-sources:未定义
process-test-sources:未定义
generate-test-resources:未定义
process-test-resources:org.apache.maven.plugins:maven-resources-plugin:2.6:testResources
test-compile:org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile
process-test-classes:未定义
test:org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test
prepare-package:未定义
package:org.apache.maven.plugins:maven-war-plugin:2.2:war
预整合测试:未定义
整合测试:未定义
集成后测试:未定义
验证:未定义
install:org.apache.maven.plugins:maven-install-plugin:2.4:install
deploy:org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy
此外,要以详细模式运行Maven命令,请指定-X
标志
请注意,这会产生非常详细的输出。