Came across this one while investigating
http://jira.codehaus.org/browse/MVERSIONS-19

This is a strange one...

in versions-maven-plugin:

http://mojo.codehaus.org/versions-maven-plugin/xref/org/codehaus/mojo/versions/api/DefaultVersionsHelper.html#186

We ask the ArtifactMetadataSource to give us a list of available versions...
that is this method:

http://maven.apache.org/ref/current/xref/org/apache/maven/project/artifact/MavenMetadataSource.html#495

This method creates a RepositoryMetadata object of type:

http://maven.apache.org/ref/current/xref/org/apache/maven/artifact/repository/metadata/ArtifactRepositoryMetadata.html#31

This metadata object is passed to the RepositoryMetadataManager:

http://maven.apache.org/ref/current/xref/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.html#58

Which asks the RepositoryMetadata object if it is a snapshot...

http://maven.apache.org/ref/current/xref/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.html#69

but our metadata object can never be a snapshot:

http://maven.apache.org/ref/current/xref/org/apache/maven/artifact/repository/metadata/ArtifactRepositoryMetadata.html#81

So the end result is that we never look in repositories which have releases
disabled... not sure if this is a Maven bug or if we should be using a
different method.

i.e. if I have:

<repository>
  <id>my-snapshot-repository</id>
  <name>My Snapshot Repository</name>
  <url>http://my.repo/snapshot</url>
  <releases>
     <enabled>*false*</enabled>
  </releases>
   <snapshots>
     <enabled>true</enabled>
   </snapshots>
</repository>

then my-snapshot-repository will never be searched, but if I have

<repository>
  <id>my-snapshot-repository</id>
  <name>My Snapshot Repository</name>
  <url>http://my.repo/snapshot</url>
  <releases>
     <enabled>*true*</enabled>
  </releases>
   <snapshots>
     <enabled>true</enabled>
   </snapshots>
</repository>

then it will!

Should I raise an issue against Maven or is this just a case of calling the
wrong method.

Reply via email to