Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions maven-repository-metadata/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ under the License.
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
50 changes: 45 additions & 5 deletions maven-repository-metadata/src/main/mdo/metadata.mdo
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ under the License.
<codeSegment>
<version>1.0.0+</version>
<code><![CDATA[
private String getSnapshotVersionKey( SnapshotVersion sv )
{
return sv.getClassifier() + ":" + sv.getExtension();
}

public boolean merge( Metadata sourceMetadata )
{
boolean changed = false;
Expand Down Expand Up @@ -178,11 +183,13 @@ under the License.
Snapshot snapshot = versioning.getSnapshot();
if ( snapshot != null )
{
boolean updateSnapshotVersions = false;
if ( s == null )
{
s = new Snapshot();
v.setSnapshot( s );
changed = true;
updateSnapshotVersions = true;
}

// overwrite
Expand All @@ -191,6 +198,7 @@ under the License.
{
s.setTimestamp( snapshot.getTimestamp() );
changed = true;
updateSnapshotVersions = true;
}
if ( s.getBuildNumber() != snapshot.getBuildNumber() )
{
Expand All @@ -202,6 +210,34 @@ under the License.
s.setLocalCopy( snapshot.isLocalCopy() );
changed = true;
}
if ( updateSnapshotVersions )
{
java.util.Map<String, SnapshotVersion> versions = new java.util.LinkedHashMap<>();
// never convert from legacy to new format if either source or target is legacy format
if ( !v.getSnapshotVersions().isEmpty() )
{
for ( SnapshotVersion sv : versioning.getSnapshotVersions() )
{
String key = getSnapshotVersionKey( sv );
versions.put( key, sv );
}
// never convert from legacy format
if ( !versions.isEmpty() )
{
for ( SnapshotVersion sv : v.getSnapshotVersions() )
{
String key = getSnapshotVersionKey( sv );
if ( !versions.containsKey( key ) )
{
versions.put( key, sv );
}
}
}
v.setSnapshotVersions( new java.util.ArrayList<SnapshotVersion>( versions.values() ) );
}

changed = true;
}
}
}
}
Expand Down Expand Up @@ -241,7 +277,7 @@ under the License.
<name>lastUpdated</name>
<version>1.0.0+</version>
<type>String</type>
<description>When the metadata was last updated (both "groupId/artifactId" and "groupId/artifactId/version" directories)</description>
<description>When the metadata was last updated (both "groupId/artifactId" and "groupId/artifactId/version" directories). The timestamp is expressed using UTC in the format yyyyMMddHHmmss.</description>
</field>
<field xdoc.separator="blank">
<name>snapshot</name>
Expand All @@ -254,7 +290,7 @@ under the License.
<field>
<name>snapshotVersions</name>
<version>1.1.0+</version>
<description>Information for each sub-artifact available in this artifact snapshot.</description>
<description>Information for each sub-artifact available in this artifact snapshot. This is only the most recent SNAPSHOT for each unique extension/classifier combination.</description>
<association>
<type>SnapshotVersion</type>
<multiplicity>*</multiplicity>
Expand Down Expand Up @@ -289,7 +325,7 @@ under the License.
<field>
<name>timestamp</name>
<version>1.0.0+</version>
<description>The time it was deployed</description>
<description>The timestamp when this version was deployed. The timestamp is expressed using UTC in the format yyyyMMdd.HHmmss.</description>
<type>String</type>
</field>
<field>
Expand All @@ -316,26 +352,30 @@ under the License.
<name>classifier</name>
<version>1.1.0+</version>
<type>String</type>
<description>The classifier of the sub-artifact.</description>
<description>The classifier of the sub-artifact. Each classifier and extension pair may only appear once.</description>
<defaultValue></defaultValue>
<identifier>true</identifier>
</field>
<field>
<name>extension</name>
<version>1.1.0+</version>
<type>String</type>
<description>The file extension of the sub-artifact.</description>
<description>The file extension of the sub-artifact. Each classifier and extension pair may only appear once.</description>
<identifier>true</identifier>
</field>
<field xml.tagName="value">
<name>version</name>
<version>1.1.0+</version>
<type>String</type>
<description>The resolved snapshot version of the sub-artifact.</description>
<identifier>true</identifier>
</field>
<field>
<name>updated</name>
<version>1.1.0+</version>
<type>String</type>
<description>The timestamp when this version information was last updated. The timestamp is expressed using UTC in the format yyyyMMddHHmmss.</description>
<identifier>true</identifier>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you show where version and updated are part of an id now?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

</field>
</fields>
</class>
Expand Down
Loading