20250115 ‐ maven central - cywongg/2025 GitHub Wiki

Sure! Let me break this down step by step and clarify the terms and concepts mentioned in your question.


What is Maven Central?

Maven Central is a widely-used repository where Java developers can publish and fetch libraries (also called artifacts) for their projects. It is the default repository used by Maven, Gradle, and other build tools to resolve dependencies. When you add a dependency to your Maven pom.xml or Gradle build.gradle file, for example, Maven Central is checked first to locate and download the specified version of the library.

Think of Maven Central as a giant public library for Java-related software.


What is Spring Registry Milestone?

The Spring Registry Milestone is a repository where the Spring team publishes milestone and pre-release versions of their libraries. These versions are not considered stable (as they are still being tested or developed further) but are available for developers who want to experiment with or test upcoming features.

Unlike Maven Central, which typically contains stable releases of libraries, the Spring Milestone repository contains experimental versions, such as:

  • Milestone builds (M1, M2, etc.)
  • Release candidates (RC1, RC2, etc.)

If you want to use such versions, you need to explicitly add the Spring Milestone repository to your project configuration. It is not included by default in Maven or Gradle.


Artifacts vs. Dependencies

  • Artifacts: An artifact is a specific file or library that has been built and is stored in a repository. It is identified by:

    • Group ID (e.g., org.springframework)
    • Artifact ID (e.g., spring-core)
    • Version (e.g., 5.3.0)

    Example: A .jar file (Java Archive) is an artifact.

  • Dependencies: Dependencies are the libraries or artifacts your project needs to function. When you declare a dependency in your project, the build tool (e.g., Maven, Gradle) fetches the corresponding artifact from a repository.

    In short: Artifacts are the physical files, while dependencies are the logical declarations that request those artifacts.


What are Remote Dependencies/Repositories?

  • Remote Dependencies: Remote dependencies are libraries or artifacts that your project fetches from remote repositories (e.g., Maven Central, Spring Milestone). These dependencies are not stored locally on your computer but are downloaded when you build your project.

  • Repositories: Repositories are storage locations where artifacts are hosted. They can be:

    • Remote Repositories: Hosted on a server (e.g., Maven Central, Spring Milestone)
    • Local Repository: A cache on your local machine where downloaded artifacts are stored
    • Private Repositories: Internal repositories set up by organizations (e.g., JFrog Artifactory, Nexus, GitHub Packages)

Your Scenario

You are trying to fetch a version of a library that does not exist in Maven Central but does exist in the Spring Milestone repository. Maven Central is the default repository, so your build tool cannot find the library unless you explicitly add the Spring Milestone repository.


Using Bond to Add the Spring Milestone Repository

To resolve this, you need to configure your project's dependencies to include the Spring Milestone repository. The repository URL for Spring Milestone is:

<repository>
    <id>spring-milestone</id>
    <name>Spring Milestone Repository</name>
    <url>https://repo.spring.io/milestone</url>
</repository>

Here’s how you can add this repository in different build tools:

Maven Configuration

In your pom.xml, you add the Spring Milestone repository under <repositories>:

<repositories>
    <repository>
        <id>spring-milestone</id>
        <name>Spring Milestone Repository</name>
        <url>https://repo.spring.io/milestone</url>
    </repository>
</repositories>

Then declare your dependency as usual:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>5.3.0-M1</version>
</dependency>

Gradle Configuration

In your build.gradle, add the Spring Milestone repository:

repositories {
    mavenCentral()
    maven {
        url "https://repo.spring.io/milestone"
    }
}

Then declare your dependency:

dependencies {
    implementation 'org.springframework:spring-core:5.3.0-M1'
}

Managing Dependencies URLs, Not Artifacts

When managing dependencies in your project, you are primarily concerned with:

  1. Configuring repositories (e.g., Maven Central, Spring Milestone) where dependencies are fetched from.
  2. Declaring dependencies (specific libraries with group ID, artifact ID, and version).

You typically do not manage artifacts (the actual files) directly. Instead, your build tool handles downloading and caching them based on your dependency declarations.


Redistributable, Remote, and Shared Repositories

These are classifications of repositories:

  • Redistributable: Repositories that contain libraries you are allowed to distribute along with your application.
  • Remote: Repositories hosted on a remote server (e.g., Maven Central, Spring Milestone).
  • Shared: Repositories used by multiple projects across teams or organizations.

Summary

  1. Maven Central: Default repository for stable artifacts.
  2. Spring Milestone: Repository for experimental Spring versions.
  3. Artifacts vs. Dependencies: Artifacts are the files; dependencies are the logical declarations.
  4. Remote Dependencies/Repositories: Dependencies fetched from remote repositories.
  5. Your task: Add the Spring Milestone repository to your project configuration to fetch the required version.

Let me know if you need further clarification!

⚠️ **GitHub.com Fallback** ⚠️