我刚开始使用Maven,并被告知在特定目录中进行mvn安装。
mvn安装到底做什么?
我认为它会在当前文件夹中查找pom.xml,并开始按照该文件中指定的指示执行。对吗?
我刚开始使用Maven,并被告知在特定目录中进行mvn安装。
mvn安装到底做什么?
我认为它会在当前文件夹中查找pom.xml,并开始按照该文件中指定的指示执行。对吗?
当前回答
-DskipTests=true是- ddmen .test.skip=true的简写形式
在。m2文件夹中的settings .xml中进行更改。你可以使用链接到本地回购,这样罐子一旦下载不应该下载一遍又一遍。
<url>file://C:/Users/admin/.m2/repository</url>
</repository>
其他回答
简短的回答
mvn install 将pom中指定的所有工件(依赖项)添加到本地存储库(从远程源)。
MVN安装的主要任务是
1)下载依赖项
2)构建项目
而job 1现在由intellij这样的id负责(他们在POM下载任何依赖项)
MVN安装现在主要用于作业2。
install:install目标由«Apache Maven install Plugin»提供:
Apache Maven Install Plugin The Install Plugin is used during the install phase to add artifact(s) to the local repository. The Install Plugin uses the information in the POM (groupId, artifactId, version) to determine the proper location for the artifact within the local repository. The local repository is the local cache where all artifacts needed for the build are stored. By default, it is located within the user's home directory (~/.m2/repository) but the location can be configured in ~/.m2/settings.xml using the <localRepository> element. — Apache Maven Install Plugin - Introduction.
话虽如此,确切的目标目的是:
install:install用于自动安装项目的主要工件(JAR、WAR或EAR)、它的POM和任何由特定项目产生的附加工件(源代码、javadoc等)。 - Apache Maven安装插件-简介。
有关目标的更多详细信息,请参阅Apache Maven Install Plugin - Install: Install页面。
有关构建生命周期的其他详细信息以及目标在构建生命周期中的位置,请参考Maven -构建生命周期介绍页面。
在maven构建生命周期的任何阶段,都会执行之前的所有目标。
例如:mvn安装将调用mvn验证,mvn编译,mvn测试,mvn包等。
你看过Maven文档吗,比如Maven安装插件文档?
果壳版本:它将构建项目并将其安装在本地存储库中。