build.gradle Principle analysis of Maven central implementation of repositories

Time:2020-10-26

If the build.gradle What happens if you change Maven central to Maven central 2?

build.gradle Principle analysis of Maven central implementation of repositories
build.gradle Principle analysis of Maven central implementation of repositories

Error message: could not find method mavencentral2() for arguments [] on repository container of type org.gradle.api . internal.artifacts.dsl .DefaultRepositoryHandler.

For this defaultrepository handler, search the gradle directory and find the corresponding java file:

build.gradle Principle analysis of Maven central implementation of repositories
build.gradle Principle analysis of Maven central implementation of repositories

DEFAULT_ MAVEN_ CENTRAL_ REPO_ The name constant is defined in the following file:

build.gradle Principle analysis of Maven central implementation of repositories

In the createmaven central repository method of the defaultbaserepository factory, create a maven repository with the URL of Repository.MAVEN_ CENTRAL_ URL:

build.gradle Principle analysis of Maven central implementation of repositories

This constant is defined in the file Artifac tRepositoryContainer.java Li:

build.gradle Principle analysis of Maven central implementation of repositories

String MAVEN_CENTRAL_URL = “https://repo.maven.apache.org/maven2/”;

You can open this URL in the browser, which stores various development libraries:

build.gradle Principle analysis of Maven central implementation of repositories

therefore build.gradle The following configuration information tells gradle to get the contents of the tool library from Maven central repository, that is, the URL https://repo.maven.apache.org…

build.gradle Principle analysis of Maven central implementation of repositories

For more original articles on Jerry, please pay attention to the official account of “Wang Zixi”:
build.gradle Principle analysis of Maven central implementation of repositories

Recommended Today

Java security framework

The article is mainly divided into three parts1. The architecture and core components of spring security are as follows: (1) authentication; (2) authority interception; (3) database management; (4) authority caching; (5) custom decision making; and;2. To build and use the environment, the current popular spring boot is used to build the environment, and the actual […]