apache / apache/maven

[MNG-6879] When the repo with the id of central is configured in settings.xml and the scope = import dependency is included in the project of the project, the central repo has a problem

Open
#8,153 9 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 40m
Merged PRs (30d)
275

Description

**[wuzishu](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=idefav)** opened **[MNG-6879](https://issues.apache.org/jira/browse/MNG-6879?redirect=false)** and commented

When the repo with the id of central is configured in settings.xml and the scope = import dependency is included in the project of the project, the central repo has a problem

 

**settings.xml配置如下**:

```java

nexusRep


nexus
Nexus Repository
https://repo.spring.io/libs-release1
true
true




nexus
Nexus pluginRepository
https://repo.spring.io/libs-release1
true
true




central


central
Nexus Repository
https://repo.spring.io/libs-release
true
true




central
Nexus pluginRepository
https://repo.spring.io/libs-release
true
true





nexusRep
central

```

 

**project pom.xml:**

```java
//代码占位符

4.0.0

org.springframework.boot
spring-boot-starter-parent
2.2.5.RELEASE


com.example
demo
0.0.1-SNAPSHOT
demo
Demo project for Spring Boot


1.8
Angel.SR6



org.springframework.boot
spring-boot-starter-web


org.springframework.cloud
spring-cloud-dependencies
${spring-cloud-dependencies.version}
pom
import


org.projectlombok
lombok
compile
true


org.springframework.boot
spring-boot-starter-test
test


org.junit.vintage
junit-vintage-engine






org.springframework.boot
spring-boot-maven-plugin




test
repo

true


true

https://repo.spring.io/libs-release

```

The theoretical maven remote repository priority is:

!image-2020-03-24-21-47-50-561.png|width=412,height=237!

However, when resolving a scope = import dependency, such as:

!image-2020-03-24-21-49-31-997.png|width=705,height=185!

The warehouse priority will become as shown in the figure below:

!image-2020-03-24-21-39-54-127.png|width=712,height=379!

Found that the central repository was reset to the default,  and all dependent downloads will become this repo priority in the future.

When resolving scope = import dependencies, this place will cause the resolving repo to become the default central:

!image-2020-03-24-21-58-35-400.png|width=663,height=194!

!image-2020-03-24-21-57-58-635.png|width=1091,height=538!

Finally at this place, the default modelResoler repo will be replaced with the default central:

!image-2020-03-24-22-00-08-867.png|width=912,height=194!

!image-2020-03-24-22-01-04-185.png|width=685,height=324!

---

**Affects:** 3.6.2

**Attachments:**
- [image-2020-03-24-21-39-54-127.png](https://issues.apache.org/jira/secure/attachment/12997563/image-2020-03-24-21-39-54-127.png) (_419.49 kB_)
- [image-2020-03-24-21-47-50-561.png](https://issues.apache.org/jira/secure/attachment/12997562/image-2020-03-24-21-47-50-561.png) (_75.69 kB_)
- [image-2020-03-24-21-49-31-997.png](https://issues.apache.org/jira/secure/attachment/12997561/image-2020-03-24-21-49-31-997.png) (_58.81 kB_)
- [image-2020-03-24-21-57-58-635.png](https://issues.apache.org/jira/secure/attachment/12997560/image-2020-03-24-21-57-58-635.png) (_353.53 kB_)
- [image-2020-03-24-21-58-35-400.png](https://issues.apache.org/jira/secure/attachment/12997559/image-2020-03-24-21-58-35-400.png) (_83.80 kB_)
- [image-2020-03-24-22-00-08-867.png](https://issues.apache.org/jira/secure/attachment/12997558/image-2020-03-24-22-00-08-867.png) (_99.64 kB_)
- [image-2020-03-24-22-01-04-185.png](https://issues.apache.org/jira/secure/attachment/12997557/image-2020-03-24-22-01-04-185.png) (_325.41 kB_)

0 votes, 6 watchers

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.