CINXE.COM
Maven2 Repository Layout – Maven
<!DOCTYPE html> <!-- | Generated by Apache Maven Doxia Site Renderer 2.0.0 from content/markdown/repository/layout.md at 2024-11-18 | Rendered using Apache Maven Fluido Skin 2.0.0 --> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="generator" content="Apache Maven Doxia Site Renderer 2.0.0" /> <title>Maven2 Repository Layout – Maven</title> <link rel="stylesheet" href="../css/apache-maven-fluido-2.0.0.min.css" /> <link rel="stylesheet" href="../css/site.css" /> <link rel="stylesheet" href="../css/print.css" media="print" /> <script src="../js/apache-maven-fluido-2.0.0.min.js"></script> <!-- Matomo --> <script> var _paq = window._paq = window._paq || []; _paq.push(['disableCookies']); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="https://analytics.apache.org/"; _paq.push(['setTrackerUrl', u+'/matomo.php']); _paq.push(['setSiteId', '3']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'/matomo.js'; s.parentNode.insertBefore(g,s); })(); </script> <!-- End Matomo Code --> </head> <body> <div class="container-fluid container-fluid-top"> <header> <div id="banner"> <div class="pull-left"><div id="bannerLeft"><h1><a href="https://www.apache.org/"><img class="class java.lang.Object" src="../images/apache-maven-project.png" /></a></h1></div></div> <div class="pull-right"><div id="bannerRight"><h1><a href=".././"><img class="class java.lang.Object" src="../images/maven-logo-black-on-white.png" /></a></h1></div></div> <div class="clear"><hr/></div> </div> <div id="breadcrumbs"> <ul class="breadcrumb"> <li><a href="https://www.apache.org/" class="externalLink">Apache</a><span class="divider">/</span></li> <li><a href="../index.html">Maven</a><span class="divider">/</span></li> <li class="active">Maven2 Repository Layout <a href="https://github.com/apache/maven-site/tree/master/content/markdown/repository/layout.md"><img src="../images/accessories-text-editor.png" alt="Edit" /></a></li> <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2024-11-18</li> <li class="pull-right"><span class="divider">|</span> <a href="../scm.html">Get Sources</a></li> <li class="pull-right"><a href="../download.cgi">Download</a></li> </ul> </div> </header> <div class="row-fluid"> <header id="leftColumn" class="span2"> <nav class="well sidebar-nav"> <ul class="nav nav-list"> <li><a href="../index.html">Welcome</a></li> <li><a href="https://www.apache.org/licenses/" class="externalLink">License</a></li> <li class="nav-header">About Maven</li> <li><a href="../what-is-maven.html">What is Maven?</a></li> <li><a href="../maven-features.html">Features</a></li> <li><a href="../download.html">Download</a></li> <li><a href="../users/index.html"><span class="icon-chevron-right"></span>Use</a></li> <li><a href="../docs/history.html">Release Notes</a></li> <li class="nav-header">Documentation</li> <li><a href="../plugins/index.html">Maven Plugins</a></li> <li><a href="../extensions/index.html">Maven Extensions</a></li> <li><a href="../guides/index.html">Index (category)</a></li> <li><a href="../users/index.html"><span class="icon-chevron-right"></span>User Centre</a></li> <li><a href="../plugin-developers/index.html"><span class="icon-chevron-right"></span>Plugin Developer Centre</a></li> <li><a href="../repositories/index.html"><span class="icon-chevron-down"></span>Maven Repository Centre</a> <ul class="nav nav-list"> <li><a href="../repository/index.html"><span class="icon-chevron-down"></span>Maven Central Repository</a> <ul class="nav nav-list"> <li><a href="../project-faq.html">Maintaining your Metadata</a></li> <li><a href="../repository/guide-central-repository-upload.html">Guide to Uploading Artifacts</a></li> <li><a href="../repository/central-metadata.html">Fixing Metadata</a></li> <li><a href="../repository/central-index.html">Central Index</a></li> <li class="active"><a>Repository Layout</a></li> </ul></li> <li><a href="../repositories/artifacts.html">Maven Artifacts</a></li> <li><a href="../repositories/metadata.html">Maven Metadata</a></li> <li><a href="../repositories/layout.html">Maven Layout</a></li> <li><a href="../repositories/local.html">Maven Local Repository</a></li> <li><a href="../repositories/remote.html">Maven Remote Repositories</a></li> </ul></li> <li><a href="../developers/index.html"><span class="icon-chevron-right"></span>Maven Developer Centre</a></li> <li><a href="../articles.html">Books and Resources</a></li> <li><a href="../security.html">Security</a></li> <li class="nav-header">Community</li> <li><a href="../community.html">Community Overview</a></li> <li><a href="../project-roles.html">Project Roles</a></li> <li><a href="../guides/development/guide-helping.html">How to Contribute</a></li> <li><a href="../users/getting-help.html">Getting Help</a></li> <li><a href="../issue-management.html">Issue Management</a></li> <li><a href="../scm.html">Getting Maven Source</a></li> <li><a href="../team.html">The Maven Team</a></li> <li class="nav-header">Project Documentation</li> <li><a href="../project-info.html"><span class="icon-chevron-right"></span>Project Information</a></li> <li class="nav-header">Maven Projects</li> <li><a href="../ref/current">Maven</a></li> <li><a href="../archetypes/index.html">Archetypes</a></li> <li><a href="../extensions/index.html">Extensions</a></li> <li><a href="../pom/index.html">Parent POMs</a></li> <li><a href="../plugins/index.html">Plugins</a></li> <li><a href="../skins/index.html">Skins</a></li> <li><a><span class="icon-chevron-down"></span>Components</a> <ul class="nav nav-list"> <li><a href="../archetype/index.html">Archetype</a></li> <li><a href="../resolver/index.html">Artifact Resolver</a></li> <li><a href="../doxia/index.html">Doxia</a></li> <li><a href="../maven-indexer/index.html">Indexer</a></li> <li><a href="../jxr/index.html">JXR</a></li> <li><a href="../plugin-testing/index.html">Plugin Testing</a></li> <li><a href="../plugin-tools/index.html">Plugin Tools</a></li> <li><a href="../apache-resource-bundles/index.html">Resource Bundles</a></li> <li><a href="../scm/index.html">SCM</a></li> <li><a href="../shared/index.html">Shared Components</a></li> <li><a href="../surefire/index.html">Surefire</a></li> <li><a href="../wagon/index.html">Wagon</a></li> </ul></li> <li class="nav-header">ASF</li> <li><a href="https://www.apache.org/foundation/how-it-works.html" class="externalLink">How Apache Works</a></li> <li><a href="https://www.apache.org/foundation/" class="externalLink">Foundation</a></li> <li><a href="https://privacy.apache.org/policies/privacy-policy-public.html" class="externalLink">Data Privacy</a></li> <li><a href="https://www.apache.org/foundation/sponsorship.html" class="externalLink">Sponsoring Apache</a></li> <li><a href="https://www.apache.org/foundation/thanks.html" class="externalLink">Thanks</a></li> </ul> </nav> <div class="well sidebar-nav"> <div id="poweredBy"> <div class="clear"></div> <div class="clear"></div> <a href="https://maven.apache.org/" class="builtBy" target="_blank"><img class="builtBy" alt="Built by Maven" src="../images/logos/maven-feather.png" /></a> </div> </div> </header> <main id="bodyColumn" class="span10"> <section><a id="Maven2_Repository_Layout"></a> <h1>Maven2 Repository Layout</h1><!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <p>Maven2 repository layout format is the default layout used since Maven 2 (see <a href="https://cwiki.apache.org/confluence/display/MAVENOLD/Repository+Layout+-+Final" class="externalLink">Repository Layout- Final</a> in <a href="https://cwiki.apache.org/confluence/display/MAVENOLD/Maven+2.0+Design+Documents" class="externalLink">Maven 2.0 Design Documents</a>), superceding old Maven 1 layout:</p> <pre class="prettyprint linenums"><code class="nohighlight nocode">Repository root |-- archetype-catalog.xml `-- ${groupId as directory}/ |-- maven-metadata.xml |-- .${checksums} `-- ${artifactId}/ |-- maven-metadata.xml |-- .${checksums} `-- ${version}/ |-- ${artifactId}-${version}.pom |-- .asc |-- .${checksums} |-- ${artifactId}-${version}.${extension} |-- .asc |-- .${checksums} |-- ${artifactId}-${version}-${classifier}.${extension} |-- .asc `-- .${checksums} </code></pre> <p>where:</p> <ul> <li><code>${groupId as directory}</code> is the groupId with <code>.</code> replaced by <code>/</code>, for example <code>org/apache/maven</code>,</li> <li><code>${artifactId}</code> is the artifactId,</li> <li><code>${version}</code> is the version, with some additional possibilities on a SNAPSHOT, see SNAPSHOT paragraph,</li> <li><code>${extension}</code> is the file extension, for example <code>zip</code> or <code>tar.gz</code>,</li> <li><code>${classifier}</code> is the artifact classifier (when available),</li> <li><code>${checksums}</code> is a list of checksums algorithms, <code>md5</code> and <code>sha1</code> by default.</li> </ul> <p><code>maven-metadata.xml</code> file format is defined in <a href="/ref/current/maven-repository-metadata/">Maven Repository Metadata Model</a>.</p> <p><code>.asc</code> file is optional (may be required in some repositories, like Central Repository) and is a PGP detached signature file.</p> <p>Obviously, <code>${groupId}</code>, <code>${artifactId}</code> and <code>${version}</code> are defined in <code>pom.xml</code>. But what about <code>${classifier}</code> and <code>${extension}</code>, how are they defined?</p> <p>Classifier and extension definition is completely different at artifact <em>publication</em> and <em>usage</em> times:</p> <ul> <li> <p><strong>At artifact publication time</strong>: Extension and classifier are defined by plugins that create the artifacts and attach them for publication.<br /> Some plugins provide configuration parameters to be able to override default values. For example, <a href="/plugins/maven-jar-plugin/jar-mojo.html">Maven JAR Plugin's <code>jar:jar</code> goal</a> produces by default an artifact with <code>jar</code> extension and empty classifier. The <code>classifier</code> goal parameter can be used to define a classifier (there is no parameter to override extension).</p></li> <li> <p><strong>At artifact usage time</strong>: Extension and classifier are defined by <a href="/ref/current/maven-model/maven.html#class_dependency"><code><dependency></code>'s <code><type></code> and <code><classifier></code></a> definition in <code>pom.xml</code>:</p> <ul> <li><code><type></code> (<code>jar</code> by default) defines the extension and default classifier: <br /> see <a href="/ref/current/maven-core/artifact-handlers.html">default artifact handlers</a> to see default types and corresponding extension and default classifier. <br /></li> <li><code><classifier></code> is optional, to override default classifier defined by the dependency type.</li> </ul></li> </ul><section><a id="SNAPSHOT"></a> <h2>SNAPSHOT</h2> <p>In case of a SNAPSHOT version, version directory uses base version, i.e. version ending in <code>-SNAPSHOT</code>, for example <code>3.8.4-SNAPSHOT</code>.</p> <p>For artifact files, there are 2 options available:</p> <ol style="list-style-type: decimal;"> <li>unique SNAPSHOT artifacts, using the same base version,</li> <li>multiple SNAPSHOT artifacts for one base version, each deployment will have an effective version where <code>SNAPSHOT</code> is replaced with <code>YYYYMMDD.HHMMSS-${counter}</code>.</li> </ol></section><section><a id="Protocol"></a> <h2>Protocol</h2> <p>Repository can be accessed through many file-oriented protocols, both for read and write: most classical are <code>file://</code>, <code>http://</code> and <code>https://</code> (<code>GET</code> and <code>PUT</code>). Older (now generally unused) protocols are FTP(S), SCP, SSH, …</p> <p>HTTP/HTTPS protocol have 2 specific characteristics:</p> <ol style="list-style-type: decimal;"> <li> <p>there is no directory listing feature: Maven does not need to list files in a directory, a remote directory does have not provide any directory listing feature,</p></li> <li> <p><a href="https://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html" class="externalLink">HTTP/1.1 Reason-Phrase</a> is used to provide extended message when artifact access is rejected by remote repository. This usage of Reason-Phrase is nowadays legacy and is removed in HTTP/2, <a href="https://issues.apache.org/jira/browse/MNG-6795" class="externalLink">MNG-6795</a> is open to create a replacement.</p></li> </ol></section><section><a id="Archetype_Catalog"></a> <h2>Archetype Catalog</h2> <p><code>archetype-catalog.xml</code> file at root directory is a <a href="/archetype/archetype-models/archetype-catalog/archetype-catalog.html">catalog of all Maven Archetypes</a> proposed in the repository.</p></section><section><a id="Additional_Content"></a> <h2>Additional Content</h2><section><a id="Index"></a> <h3>Index</h3> <p><a href="https://repo.maven.apache.org/maven2/.index/" class="externalLink"><code>.index</code></a> directory at root directory is an <a href="/maven-indexer/indexer-core/">index</a> of the content, done by <a href="/maven-indexer/">Maven Indexer</a>.</p> <p>If contains index files in 2 flavours:</p> <ul> <li>full index: <code>nexus-maven-repository-index.gz</code></li> <li>incremental index: <code>nexus-maven-repository-index.<n>.gz</code> + <code>nexus-maven-repository-index.properties</code></li> </ul></section><section><a id="Metadata"></a> <h3>Metadata</h3> <p><a href="https://repo.maven.apache.org/maven2/.meta/" class="externalLink"><code>.meta</code></a> directory at root directory contains a few metadata files:</p> <ul> <li><code>prefixes.txt</code></li> <li><code>repository-metadata.xml</code></li> </ul></section></section></section> </main> </div> </div> <hr/> <footer> <div class="container-fluid"> <div class="row-fluid"> <p>© 2002–2024 <a href="https://www.apache.org/">The Apache Software Foundation</a> </p> </div> </div> </footer> </body> </html>