简体   繁体   中英

maven and eclipse build conflict

I'm new to maven and eclipse and trying to familiarize myself with an existing framework we have.

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. I also scp'ed over the "repository" folder into .m2 from another user.

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. However I can only build within eclipse (run as maven build with goals- jetty:run) with the mirrors section intact. Without the mirrors url, it will download a bunch of stuff and then fail due to dependencies. What is going on here and how do I resolve this. What is being looked at by maven? the settings.xml or repository, how are they related? 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? 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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