1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.maven.api; 20 21 import org.apache.maven.api.annotations.Experimental; 22 import org.apache.maven.api.annotations.Immutable; 23 import org.apache.maven.api.annotations.Nonnull; 24 import org.apache.maven.api.model.ModelBase; 25 26 /** 27 * <p>A <dfn>remote repository</dfn> is a central or distributed location 28 * from which Maven can download project dependencies, plugins, and other 29 * build artifacts. When Maven cannot find an artifact in the local 30 * repository, it attempts to retrieve it from one or more remote 31 * repositories.</p> 32 * 33 * <p>There are several types of remote repositories:</p><ul> 34 * <li><dfn>Central Repository</dfn>: The default remote repository used by Maven. It is a large, publicly accessible repository maintained by the Maven community at https://repo.maven.apache.org/maven2. Most common Java libraries and frameworks are hosted here.</li> 35 * <li><dfn>Private Remote Repository</dfn>: Organizations often maintain their own private remote repositories, which may host proprietary or custom-built artifacts that are not available in the central repository. These repositories can be managed using tools like Apache Archiva, Sonatype Nexus, or JFrog Artifactory.</li> 36 * <li><dfn>Third-Party Repositories</dfn>: Some projects or organizations host their own remote repositories for distributing specific artifacts that are not available in the central repository. These repositories must be explicitly added to the Maven pom.xml or settings.xml files for Maven to access them.</li></ul> 37 * 38 * <h2>Repository Configuration</h2> 39 * 40 * <p>Repositories can be configured at various levels:</p><ol> 41 * <li>POM: Repositories can be specified in the {@code pom.xml} file under the {@code <repositories>} and {@code <pluginRepositories>} sections.</li> 42 * <li>Settings: the {@code settings.xml} can be used to provide additional repositories in the three level of settings (user, project, installation).</li> 43 * </ol> 44 * <p>By understanding and properly configuring repositories, developers can control where Maven looks for dependencies, manage access to proprietary artifacts, and optimize the build process to ensure consistency and reliability across projects. 45 * </p> 46 * 47 * 48 * @since 4.0.0 49 * @see Repository 50 * @see LocalRepository 51 * @see Session#getSettings() 52 * @see ModelBase#getRepositories() 53 * @see ModelBase#getPluginRepositories() 54 */ 55 @Experimental 56 @Immutable 57 public interface RemoteRepository extends Repository { 58 59 @Nonnull 60 String getUrl(); 61 62 @Nonnull 63 String getProtocol(); 64 }