简体   繁体   English

maven和eclipse构建冲突

[英]maven and eclipse build conflict

I'm new to maven and eclipse and trying to familiarize myself with an existing framework we have. 我是maven和eclipse的新手,并试图熟悉我们现有的框架。

On ubuntu I installed maven3, pulled down 2 repositories from git (one relies on the other), did a mvn clean install on both and then imported those two into Eclipse and created a settings.xml file with the contents below and placed it in the .m2 directory. 在ubuntu上我安装了maven3,从git中删除了2个存储库(一个依赖于另一个),在两者上进行了mvn clean安装,然后将这两个导入到Eclipse中并创建了一个settings.xml文件,其中包含以下内容并将其放入.m2目录。 I also scp'ed over the "repository" folder into .m2 from another user. 我还将“repository”文件夹从另一个用户scp到了.m2。

Issues: 问题:

on the command line, "mvn clean install" generates a failed build (complaining the url specified in the mirrors section is refusing connection) but works when I take out the mirrors section. 在命令行上,“mvn clean install”生成一个失败的构建(抱怨镜像部分中指定的URL拒绝连接),但是当我拿出镜像部分时就可以工作。 However I can only build within eclipse (run as maven build with goals- jetty:run) with the mirrors section intact. 但是我只能在eclipse中构建(运行作为maven build with goal-jetty:run),镜像部分完好无损。 Without the mirrors url, it will download a bunch of stuff and then fail due to dependencies. 如果没有镜像URL,它将下载一堆东西,然后由于依赖性而失败。 What is going on here and how do I resolve this. 这里发生了什么,我该如何解决这个问题。 What is being looked at by maven? maven正在看什么? the settings.xml or repository, how are they related? settings.xml或repository,它们是如何相关的? It seems without the mirrors url, it's just searching within repository? 似乎没有镜像网址,它只是在存储库中搜索? I know it's somewhat vague. 我知道这有些模糊。

<settings>
<servers>
  <server>
    ...
  </server>
</servers>
<mirrors>
  <mirror>
    <!--This sends everything else to /public -->
    <id>..</id>
    <mirrorOf>..</mirrorOf>
    <url>..</url>
  </mirror>
</mirrors>
<profiles>
  <profile>
    <repositories>
     ..
    </repositories>
   <pluginRepositories>
      <pluginRepository>
        ..
      </pluginRepository>
    </pluginRepositories>
  </profile>
</profiles>
<activeProfiles>
  ..
</activeProfiles>
</settings>

Please check the usage of mirrors here . 请在这里查看镜子的使用情况。 And also why did you create a new settings.xml file? 还有为什么要创建一个新的settings.xml文件? Maven's main settings file can be found at %MVN_HOME\\conf", for example in my case it is located at "C:\\WorkSoft\\apache-maven-3.2.1\\conf" and this settings file is used when you run the build from command line. Maven的主要设置文件可以在%MVN_HOME \\ conf“中找到,例如在我的情况下它位于”C:\\ WorkSoft \\ apache-maven-3.2.1 \\ conf“,并且在运行构建时使用此设置文件从命令行。

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

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