我刚开始使用Maven,并被告知在特定目录中进行mvn安装。
mvn安装到底做什么?
我认为它会在当前文件夹中查找pom.xml,并开始按照该文件中指定的指示执行。对吗?
我刚开始使用Maven,并被告知在特定目录中进行mvn安装。
mvn安装到底做什么?
我认为它会在当前文件夹中查找pom.xml,并开始按照该文件中指定的指示执行。对吗?
当前回答
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 -构建生命周期介绍页面。
其他回答
简短的回答
mvn install 将pom中指定的所有工件(依赖项)添加到本地存储库(从远程源)。
MVN安装的主要任务是
1)下载依赖项
2)构建项目
而job 1现在由intellij这样的id负责(他们在POM下载任何依赖项)
MVN安装现在主要用于作业2。
重要的是要指出安装和安装:安装是不同的东西,安装是一个阶段,在这个阶段,maven做的不仅仅是将当前项目模块工件安装到本地存储库,它首先检查远程存储库。另一方面,install:install是一个目标,它只是构建你当前的项目,并将所有的构件安装到本地存储库(例如到.m2目录)。
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 -构建生命周期介绍页面。
-DskipTests=true是- ddmen .test.skip=true的简写形式
在。m2文件夹中的settings .xml中进行更改。你可以使用链接到本地回购,这样罐子一旦下载不应该下载一遍又一遍。
<url>file://C:/Users/admin/.m2/repository</url>
</repository>