简体   繁体   English

Maven在哪里安装jars?

[英]Where does maven install jars?

So I copied a Repo from my team lead's work-space into my work-space. 因此,我从团队负责人的工作空间复制了一个Repo到我的工作空间。 Literally using unix CP. 从字面上使用unix CP。

Now whenever I run mvn clean install , it installs the compiled jar into the his work space. 现在,每当我运行mvn clean install ,它都会将已编译的jar安装到他的工作空间中。

I have checked the pom.xml in the repo and it doesn't explicitly define the target location. 我已经检查了仓库中的pom.xml,它没有明确定义目标位置。

I've also checked my printenv . 我还检查了我的printenv There is no mention of my TL's work-space in any of the environment variables. 在任何环境变量中都没有提及我的TL的工作空间。 Where is the location of my TL's work-space coming form? 我的TL工作空间即将到来的位置在哪里?

in the .m2 repository there is a settings.xml which normally includes a path, since you just copied it you will most certenly have his path there 在.m2存储库中,有一个settings.xml文件,该文件通常包含一个路径,因为您刚刚复制了该路径,您肯定会在其中找到他的路径

  • Windows: C:\\Users\\USERNAME.m2\\settings.xml Windows:C:\\ Users \\ USERNAME.m2 \\ settings.xml
  • Linux:/home/USERNNAME/.m2/settings.xml Linux操作系统:/home/USERNNAME/.m2/settings.xml

In the file there is a 'localRepository' tag (Check it) 在文件中有一个“ localRepository”标签(选中它)

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      https://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository>SomePath/.m2/repository</localRepository>
  <interactiveMode>true</interactiveMode>
  <offline>false</offline>
  ...
</settings>

You can find your installed JARs and dependencies in your local repository. 您可以在本地存储库中找到已安装的JAR和依赖项。

By default, you can find it here: 默认情况下,您可以在这里找到它:

  • Windows: C:\\Users\\USERNAME\\.m2\\repository Windows: C:\\Users\\USERNAME\\.m2\\repository
  • Linux: /home/USERNNAME/.m2/repository Linux: /home/USERNNAME/.m2/repository
  • MacOS: /Users/USERNAME/.m2/repository MacOS: /Users/USERNAME/.m2/repository

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM