mvn使用笔记
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mvn使用笔记相关的知识,希望对你有一定的参考价值。
mvn命令格式:
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>.
第一种格式:lifecycle phase Available lifecycle phases are: default生命周期 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, clean生命周期 pre-clean, clean, post-clean, site生命周期 pre-site, site, post-site, site-deploy.
第二种格式:a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>
举例说明:
查看help插件的帮助信息
mvn help:help
[INFO] Maven Help Plugin 2.2 The Maven Help plugin provides goals aimed at helping to make sense out of the build environment. It includes the ability to view the effective POM and settings files, after inheritance and active profiles have been applied, as well as a describe a particular plugin goal to give usage information. This plugin has 9 goals: help:active-profiles Displays a list of the profiles which are currently active for this build. help:all-profiles Displays a list of available profiles under the current project. Note: it will list all profiles for a project. If a profile comes up with a status inactive then there might be a need to set profile activation switches/property. help:describe Displays a list of the attributes for a Maven Plugin and/or goals (aka Mojo - Maven plain Old Java Object). help:effective-pom Displays the effective POM as an XML for this build, with the active profiles factored in. help:effective-settings Displays the calculated settings as XML for this project, given any profile enhancement and the inheritance of the global settings into the user-level settings. help:evaluate Evaluates Maven expressions given by the user in an interactive mode. help:expressions Displays the supported Plugin expressions used by Maven. help:help Display help information on maven-help-plugin. Call mvn help:help -Ddetail=true -Dgoal=<goal-name> to display parameter details. help:system Displays a list of the platform details like system properties and environment variables.
查看dependency的帮助信息 mvn dependency:help [INFO] Apache Maven Dependency Plugin 2.10 Provides utility goals to work with dependencies like copying, unpacking, analyzing, resolving and many more. This plugin has 22 goals: dependency:analyze Analyzes the dependencies of this project and determines which are: used and declared; used and undeclared; unused and declared. This goal is intended to be used standalone, thus it always executes the test-compile phase - use the dependency:analyze-only goal instead when participating in the build lifecycle. By default, maven-dependency-analyzer is used to perform the analysis, with limitations due to the fact that it works at bytecode level, but any analyzer can be plugged in through analyzer parameter. 。。。。。 dependency:build-classpath This goal will output a classpath string of dependencies from the local repository to a file or log. dependency:copy Goal that copies a list of artifacts from the repository to defined locations. dependency:copy-dependencies Goal that copies the project dependencies from the repository to a defined location. dependency:display-ancestors Displays all ancestor POMs of the project. This may be useful in a continuous integration system where you want to know all parent poms of the project. dependency:get Resolves a single artifact, eventually transitively, from the specified remote repositories. Caveat: will always check thecentral repository defined in the super pom. You could use a mirror entry in your settings.xml dependency:go-offline Goal that resolves all project dependencies, including plugins and reports and their dependencies. dependency:help Display help information on maven-dependency-plugin. Call mvn dependency:help -Ddetail=true -Dgoal=<goal-name> to display parameter details. dependency:list Displays the list of dependencies for this project. dependency:list-repositories Goal that resolves all project dependencies and then lists the repositories used by the build and by the transitive dependencies dependency:properties Goal that sets a property pointing to the artifact file for each project dependency. For each dependency (direct and transitive) a project property will be set which follows the groupId:artifactId:type:[classifier] form and contains the path to the resolved artifact. dependency:purge-local-repository Remove the project dependencies from the local repository, and optionally re-resolve them. dependency:resolve Goal that resolves the project dependencies from the repository. dependency:resolve-plugins Goal that resolves all project plugins and reports and their dependencies. dependency:sources Goal that resolves the project source dependencies from the repository. dependency:tree Displays the dependency tree for this project. 。。。
其他说明: -Ddetail=true 显示详细的执行信息 To see the full stack trace of the errors, re-run Maven with the -e switch. Re-run Maven using the -X switch to enable full debug logging. -P 显示的激活一个profile -D 显示的指定系统属性
以上是关于mvn使用笔记的主要内容,如果未能解决你的问题,请参考以下文章
spring 笔记1: mvn 中Controller方法的参数不能是嵌套类(内部类)。
内网机器,使用mvn打包时怎样指定使用本地仓库,而不去外网(中央仓库)下载