简体   繁体   English

用于查找工作区工件的maven settings.xml配置

[英]maven settings.xml configuration for looking up workspace artifacts

I'm using maven and I'm currently stumped with the following issue: 我正在使用maven,目前遇到以下问题:

Project setup: 项目设置:

- master (parent project)
- module1 (parent is master)
- module2 (parent is master and needs module1 as "provided")

As shown in the following settings.xml, I'm making the artifactory as a mirror for all artifact requests. 如以下settings.xml中所示,我将工件作为所有工件请求的镜像。 This is in a way needed because there are few proprietary jars that my build needs (and artifactory is responsible it). 这是一种需要的方式,因为构建所需的专有jar很少(而工件则由它负责)。

settings.xml: settings.xml中:

    <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 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository>${user.home}/.m2/repository</localRepository>
  <interactiveMode>true</interactiveMode>
  <usePluginRegistry>false</usePluginRegistry>
  <offline>false</offline>
  <mirrors>
    <mirror>
      <id>artifactory-virtual-repo</id>
      <name>myartifactory</name>
      <url>http://<artifactory-ip>:8081/artifactory/simple/<repo-name>/</url>
      <mirrorOf>*</mirrorOf>
    </mirror>
  </mirrors>
  <proxies/>
  <profiles/> 
  <activeProfiles/>
</settings>

module1 builds fine. module1构建良好。 However, when I try to build master or module2 it is checking for module1 in the artifactory (mentioned above in settings.xml) where these projects are still missing. 但是,当我尝试构建master或module2时,它正在检查其中仍缺少这些项目的工件(上面在settings.xml中提到)中的module1。 How can I force eclipse (m2e) to look at workspace projects as well? 如何强制Eclipse(m2e)也查看工作区项目?

In otherwords, how do I configure maven to make sure that artifacts in the current workspace are also looked up if it fails to find it in the repository ? 换句话说,如果无法在存储库中找到当前工作空间中的工件,我该如何配置它以确保也可以在其中找到工件?

Maven considers dependencies "inner" (and looks for classes in the project instead of going after jars) once they are declared as modules in the reactor. 一旦在反应堆中将依赖项声明为模块,Maven便将其视为“内部”依赖项(并在项目中查找类而不是遵循jar)。 If your parent pom has the following modules declaration, Maven shouldn't reach out to Artifactory, but should use the compiled classes: 如果您的父pom具有以下模块声明,则Maven不应联系Artifactory,而应使用已编译的类:

<modules>
    <module>module1</module>
    <module>module2</module>
</modules>

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

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