@@ -1,167 +0,0 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!-- | |||
~ 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. | |||
--> | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<parent> | |||
<groupId>org.apache.archiva.maven</groupId> | |||
<artifactId>archiva-maven</artifactId> | |||
<version>3.0.0-SNAPSHOT</version> | |||
</parent> | |||
<modelVersion>4.0.0</modelVersion> | |||
<artifactId>archiva-maven-converter</artifactId> | |||
<name>Archiva :: Maven :: Repository Converter</name> | |||
<properties> | |||
<site.staging.base>${project.parent.parent.basedir}</site.staging.base> | |||
</properties> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.apache.archiva</groupId> | |||
<artifactId>archiva-consumer-api</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.archiva</groupId> | |||
<artifactId>archiva-transaction</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.maven.shared</groupId> | |||
<artifactId>maven-model-converter</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.maven</groupId> | |||
<artifactId>maven-core</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.archiva</groupId> | |||
<artifactId>archiva-checksum</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.archiva</groupId> | |||
<artifactId>archiva-repository-layer</artifactId> | |||
<exclusions> | |||
<exclusion> | |||
<groupId>commons-logging</groupId> | |||
<artifactId>commons-logging-api</artifactId> | |||
</exclusion> | |||
<exclusion> | |||
<groupId>log4j</groupId> | |||
<artifactId>log4j</artifactId> | |||
</exclusion> | |||
</exclusions> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.archiva</groupId> | |||
<artifactId>archiva-repository-scanner</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.archiva</groupId> | |||
<artifactId>archiva-plexus-bridge</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.archiva</groupId> | |||
<artifactId>archiva-common</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.archiva.maven</groupId> | |||
<artifactId>archiva-maven-repository</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.maven.wagon</groupId> | |||
<artifactId>wagon-http</artifactId> | |||
<scope>provided</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.maven.wagon</groupId> | |||
<artifactId>wagon-http-lightweight</artifactId> | |||
<scope>provided</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.archiva</groupId> | |||
<artifactId>archiva-test-utils</artifactId> | |||
<version>${project.version}</version> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.archiva.components.cache</groupId> | |||
<artifactId>archiva-components-spring-cache-ehcache</artifactId> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.ow2.asm</groupId> | |||
<artifactId>asm</artifactId> | |||
<scope>test</scope> | |||
</dependency> | |||
</dependencies> | |||
<build> | |||
<plugins> | |||
<plugin> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<artifactId>maven-surefire-plugin</artifactId> | |||
<configuration> | |||
<systemPropertyVariables> | |||
<basedir>${basedir}</basedir> | |||
<appserver.base>${project.build.directory}/appserver-base</appserver.base> | |||
</systemPropertyVariables> | |||
</configuration> | |||
</plugin> | |||
</plugins> | |||
<pluginManagement> | |||
<plugins> | |||
<plugin> | |||
<groupId>org.apache.rat</groupId> | |||
<artifactId>apache-rat-plugin</artifactId> | |||
<configuration> | |||
<excludes> | |||
<exclude>src/test/expected-files/**</exclude> | |||
<exclude>src/test/source-repository/**</exclude> | |||
</excludes> | |||
</configuration> | |||
</plugin> | |||
</plugins> | |||
</pluginManagement> | |||
</build> | |||
<profiles> | |||
<profile> | |||
<id>jdk9+</id> | |||
<activation> | |||
<jdk>[1.9,)</jdk> | |||
</activation> | |||
<dependencies> | |||
<!-- Needed for JDK >= 9 --> | |||
<dependency> | |||
<groupId>javax.annotation</groupId> | |||
<artifactId>javax.annotation-api</artifactId> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>javax.xml.bind</groupId> | |||
<artifactId>jaxb-api</artifactId> | |||
<scope>test</scope> | |||
</dependency> | |||
</dependencies> | |||
</profile> | |||
</profiles> | |||
</project> |
@@ -1,38 +0,0 @@ | |||
package org.apache.archiva.converter; | |||
/* | |||
* 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. | |||
*/ | |||
/** | |||
* Exception occuring during repository conversion. | |||
* | |||
*/ | |||
public class RepositoryConversionException | |||
extends Exception | |||
{ | |||
public RepositoryConversionException( String message ) | |||
{ | |||
super( message ); | |||
} | |||
public RepositoryConversionException( String message, Throwable cause ) | |||
{ | |||
super( message, cause ); | |||
} | |||
} |
@@ -1,49 +0,0 @@ | |||
package org.apache.archiva.converter.artifact; | |||
/* | |||
* 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. | |||
*/ | |||
/** | |||
* ArtifactConversionException | |||
* | |||
* | |||
*/ | |||
public class ArtifactConversionException | |||
extends Exception | |||
{ | |||
public ArtifactConversionException() | |||
{ | |||
} | |||
public ArtifactConversionException( String message ) | |||
{ | |||
super( message ); | |||
} | |||
public ArtifactConversionException( Throwable cause ) | |||
{ | |||
super( cause ); | |||
} | |||
public ArtifactConversionException( String message, Throwable cause ) | |||
{ | |||
super( message, cause ); | |||
} | |||
} |
@@ -1,56 +0,0 @@ | |||
package org.apache.archiva.converter.artifact; | |||
/* | |||
* 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. | |||
*/ | |||
import org.apache.maven.artifact.Artifact; | |||
import org.apache.maven.artifact.repository.ArtifactRepository; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* ArtifactConverter | |||
* | |||
* | |||
*/ | |||
public interface ArtifactConverter | |||
{ | |||
/** | |||
* Convert an provided artifact, and place it into the destination repository. | |||
* | |||
* @param artifact the artifact to convert. | |||
* @param destinationRepository the respository to send the artifact to. | |||
* @throws ArtifactConversionException | |||
*/ | |||
void convert( Artifact artifact, ArtifactRepository destinationRepository ) | |||
throws ArtifactConversionException; | |||
/** | |||
* Get the map of accumulated warnings for the conversion. | |||
* | |||
* @return the {@link Map}<{@link Artifact}, {@link String}> warning messages. | |||
*/ | |||
Map<Artifact, List<String>> getWarnings(); | |||
/** | |||
* Clear the list of warning messages. | |||
*/ | |||
void clearWarnings(); | |||
} |
@@ -1,90 +0,0 @@ | |||
package org.apache.archiva.converter.artifact; | |||
/* | |||
* 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. | |||
*/ | |||
import org.apache.maven.artifact.Artifact; | |||
import org.apache.maven.artifact.handler.ArtifactHandler; | |||
import org.apache.maven.artifact.metadata.ArtifactMetadata; | |||
import org.apache.maven.artifact.repository.ArtifactRepository; | |||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; | |||
import org.codehaus.plexus.component.annotations.Component; | |||
/** | |||
* @author jdcasey | |||
*/ | |||
@Component( role = ArtifactRepositoryLayout.class, hint = "legacy") | |||
public class LegacyRepositoryLayout | |||
implements ArtifactRepositoryLayout | |||
{ | |||
private static final String PATH_SEPARATOR = "/"; | |||
public String getId() | |||
{ | |||
return "legacy"; | |||
} | |||
@Override | |||
public String pathOf( Artifact artifact ) | |||
{ | |||
ArtifactHandler artifactHandler = artifact.getArtifactHandler(); | |||
StringBuilder path = new StringBuilder( 128 ); | |||
path.append( artifact.getGroupId() ).append( '/' ); | |||
path.append( artifactHandler.getDirectory() ).append( '/' ); | |||
path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() ); | |||
if ( artifact.hasClassifier() ) | |||
{ | |||
path.append( '-' ).append( artifact.getClassifier() ); | |||
} | |||
if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 ) | |||
{ | |||
path.append( '.' ).append( artifactHandler.getExtension() ); | |||
} | |||
return path.toString(); | |||
} | |||
@Override | |||
public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository ) | |||
{ | |||
return pathOfRepositoryMetadata( metadata, metadata.getLocalFilename( repository ) ); | |||
} | |||
private String pathOfRepositoryMetadata( ArtifactMetadata metadata, String filename ) | |||
{ | |||
StringBuilder path = new StringBuilder( 128 ); | |||
path.append( metadata.getGroupId() ).append( PATH_SEPARATOR ).append( "poms" ).append( PATH_SEPARATOR ); | |||
path.append( filename ); | |||
return path.toString(); | |||
} | |||
@Override | |||
public String pathOfRemoteRepositoryMetadata( ArtifactMetadata metadata ) | |||
{ | |||
return pathOfRepositoryMetadata( metadata, metadata.getRemoteFilename() ); | |||
} | |||
} |
@@ -1,730 +0,0 @@ | |||
package org.apache.archiva.converter.artifact; | |||
/* | |||
* 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. | |||
*/ | |||
import org.apache.archiva.checksum.ChecksumAlgorithm; | |||
import org.apache.archiva.checksum.ChecksumValidationException; | |||
import org.apache.archiva.checksum.ChecksummedFile; | |||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; | |||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; | |||
import org.apache.archiva.transaction.FileTransaction; | |||
import org.apache.archiva.transaction.TransactionException; | |||
import org.apache.commons.io.FileUtils; | |||
import org.apache.maven.artifact.Artifact; | |||
import org.apache.maven.artifact.factory.ArtifactFactory; | |||
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager; | |||
import org.apache.maven.artifact.repository.ArtifactRepository; | |||
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; | |||
import org.apache.maven.artifact.repository.metadata.Metadata; | |||
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata; | |||
import org.apache.maven.artifact.repository.metadata.Snapshot; | |||
import org.apache.maven.artifact.repository.metadata.Versioning; | |||
import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader; | |||
import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Writer; | |||
import org.apache.maven.model.DistributionManagement; | |||
import org.apache.maven.model.Model; | |||
import org.apache.maven.model.Relocation; | |||
import org.apache.maven.model.converter.ModelConverter; | |||
import org.apache.maven.model.converter.PomTranslationException; | |||
import org.apache.maven.model.io.xpp3.MavenXpp3Writer; | |||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException; | |||
import org.springframework.stereotype.Service; | |||
import javax.annotation.PostConstruct; | |||
import javax.inject.Inject; | |||
import java.io.IOException; | |||
import java.io.Reader; | |||
import java.io.StringReader; | |||
import java.io.StringWriter; | |||
import java.nio.charset.Charset; | |||
import java.nio.file.Files; | |||
import java.nio.file.Path; | |||
import java.nio.file.Paths; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Properties; | |||
import java.util.regex.Matcher; | |||
/** | |||
* LegacyToDefaultConverter | |||
*/ | |||
@Service("artifactConverter#legacy-to-default") | |||
public class LegacyToDefaultConverter | |||
implements ArtifactConverter | |||
{ | |||
/** | |||
* | |||
*/ | |||
private List<ChecksumAlgorithm> digesters; | |||
@Inject | |||
private PlexusSisuBridge plexusSisuBridge; | |||
private ModelConverter translator; | |||
private ArtifactFactory artifactFactory; | |||
private ArtifactHandlerManager artifactHandlerManager; | |||
private boolean force; | |||
private boolean dryrun; | |||
private Map<Artifact, List<String>> warnings = new HashMap<>(); | |||
@PostConstruct | |||
public void initialize() | |||
throws PlexusSisuBridgeException | |||
{ | |||
// TODO: Should be configurable! | |||
this.digesters = Arrays.asList(ChecksumAlgorithm.SHA256, ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5); | |||
translator = plexusSisuBridge.lookup( ModelConverter.class ); | |||
artifactFactory = plexusSisuBridge.lookup( ArtifactFactory.class ); | |||
artifactHandlerManager = plexusSisuBridge.lookup( ArtifactHandlerManager.class ); | |||
} | |||
@Override | |||
public void convert( Artifact artifact, ArtifactRepository targetRepository ) | |||
throws ArtifactConversionException | |||
{ | |||
if ( artifact.getRepository().getUrl().equals( targetRepository.getUrl() ) ) | |||
{ | |||
throw new ArtifactConversionException( Messages.getString( "exception.repositories.match" ) ); //$NON-NLS-1$ | |||
} | |||
if ( !validateMetadata( artifact ) ) | |||
{ | |||
addWarning( artifact, Messages.getString( "unable.to.validate.metadata" ) ); //$NON-NLS-1$ | |||
return; | |||
} | |||
FileTransaction transaction = new FileTransaction(); | |||
if ( !copyPom( artifact, targetRepository, transaction ) ) | |||
{ | |||
addWarning( artifact, Messages.getString( "unable.to.copy.pom" ) ); //$NON-NLS-1$ | |||
return; | |||
} | |||
if ( !copyArtifact( artifact, targetRepository, transaction ) ) | |||
{ | |||
addWarning( artifact, Messages.getString( "unable.to.copy.artifact" ) ); //$NON-NLS-1$ | |||
return; | |||
} | |||
Metadata metadata = createBaseMetadata( artifact ); | |||
Versioning versioning = new Versioning(); | |||
versioning.addVersion( artifact.getBaseVersion() ); | |||
metadata.setVersioning( versioning ); | |||
updateMetadata( new ArtifactRepositoryMetadata( artifact ), targetRepository, metadata, transaction ); | |||
metadata = createBaseMetadata( artifact ); | |||
metadata.setVersion( artifact.getBaseVersion() ); | |||
versioning = new Versioning(); | |||
Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher( artifact.getVersion() ); | |||
if ( matcher.matches() ) | |||
{ | |||
Snapshot snapshot = new Snapshot(); | |||
snapshot.setBuildNumber( Integer.parseInt( matcher.group( 3 ) ) ); | |||
snapshot.setTimestamp( matcher.group( 2 ) ); | |||
versioning.setSnapshot( snapshot ); | |||
} | |||
// TODO: merge latest/release/snapshot from source instead | |||
metadata.setVersioning( versioning ); | |||
updateMetadata( new SnapshotArtifactRepositoryMetadata( artifact ), targetRepository, metadata, transaction ); | |||
if ( !dryrun ) | |||
{ | |||
try | |||
{ | |||
transaction.commit(); | |||
} | |||
catch ( TransactionException e ) | |||
{ | |||
throw new ArtifactConversionException( Messages.getString( "transaction.failure", e.getMessage() ), | |||
e ); //$NON-NLS-1$ | |||
} | |||
} | |||
} | |||
@SuppressWarnings("unchecked") | |||
private boolean copyPom( Artifact artifact, ArtifactRepository targetRepository, FileTransaction transaction ) | |||
throws ArtifactConversionException | |||
{ | |||
Artifact pom = artifactFactory.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(), | |||
artifact.getVersion() ); | |||
pom.setBaseVersion( artifact.getBaseVersion() ); | |||
ArtifactRepository repository = artifact.getRepository(); | |||
Path file = Paths.get( repository.getBasedir(), repository.pathOf( pom ) ); | |||
boolean result = true; | |||
if ( Files.exists(file) ) | |||
{ | |||
Path targetFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( pom ) ); | |||
String contents = null; | |||
boolean checksumsValid = false; | |||
try | |||
{ | |||
if ( testChecksums( artifact, file ) ) | |||
{ | |||
checksumsValid = true; | |||
} | |||
// Even if the checksums for the POM are invalid we should still convert the POM | |||
contents = org.apache.archiva.common.utils.FileUtils.readFileToString( file, Charset.defaultCharset() ); | |||
} | |||
catch ( IOException e ) | |||
{ | |||
throw new ArtifactConversionException( | |||
Messages.getString( "unable.to.read.source.pom", e.getMessage() ), e ); //$NON-NLS-1$ | |||
} | |||
if ( checksumsValid && contents.indexOf( "modelVersion" ) >= 0 ) //$NON-NLS-1$ | |||
{ | |||
// v4 POM | |||
boolean matching = false; | |||
if ( !force && Files.exists( targetFile ) ) | |||
{ | |||
String targetContents = org.apache.archiva.common.utils.FileUtils.readFileToString( targetFile, Charset.defaultCharset( ) ); | |||
matching = targetContents.equals( contents ); | |||
} | |||
if ( force || !matching ) | |||
{ | |||
transaction.createFile( contents, targetFile, digesters ); | |||
} | |||
} | |||
else | |||
{ | |||
// v3 POM | |||
try (StringReader stringReader = new StringReader( contents )) | |||
{ | |||
try (StringWriter writer = new StringWriter()) | |||
{ | |||
org.apache.maven.model.v3_0_0.io.xpp3.MavenXpp3Reader v3Reader = | |||
new org.apache.maven.model.v3_0_0.io.xpp3.MavenXpp3Reader(); | |||
org.apache.maven.model.v3_0_0.Model v3Model = v3Reader.read( stringReader ); | |||
if ( doRelocation( artifact, v3Model, targetRepository, transaction ) ) | |||
{ | |||
Artifact relocatedPom = | |||
artifactFactory.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(), | |||
artifact.getVersion() ); | |||
targetFile = | |||
Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( relocatedPom ) ); | |||
} | |||
Model v4Model = translator.translate( v3Model ); | |||
translator.validateV4Basics( v4Model, v3Model.getGroupId(), v3Model.getArtifactId(), | |||
v3Model.getVersion(), v3Model.getPackage() ); | |||
MavenXpp3Writer xpp3Writer = new MavenXpp3Writer(); | |||
xpp3Writer.write( writer, v4Model ); | |||
transaction.createFile( writer.toString(), targetFile, digesters ); | |||
List<String> warnings = translator.getWarnings(); | |||
for ( String message : warnings ) | |||
{ | |||
addWarning( artifact, message ); | |||
} | |||
} | |||
catch ( XmlPullParserException e ) | |||
{ | |||
addWarning( artifact, | |||
Messages.getString( "invalid.source.pom", e.getMessage() ) ); //$NON-NLS-1$ | |||
result = false; | |||
} | |||
catch ( IOException e ) | |||
{ | |||
throw new ArtifactConversionException( Messages.getString( "unable.to.write.converted.pom" ), | |||
e ); //$NON-NLS-1$ | |||
} | |||
catch ( PomTranslationException e ) | |||
{ | |||
addWarning( artifact, | |||
Messages.getString( "invalid.source.pom", e.getMessage() ) ); //$NON-NLS-1$ | |||
result = false; | |||
} | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
addWarning( artifact, Messages.getString( "warning.missing.pom" ) ); //$NON-NLS-1$ | |||
} | |||
return result; | |||
} | |||
private boolean testChecksums( Artifact artifact, Path file ) | |||
throws IOException | |||
{ | |||
boolean result = true; | |||
for ( ChecksumAlgorithm digester : digesters ) | |||
{ | |||
result &= verifyChecksum( file, file.getFileName() + "." + getDigesterFileExtension( digester ), digester, | |||
//$NON-NLS-1$ | |||
artifact, | |||
"failure.incorrect." + getDigesterFileExtension( digester ) ); //$NON-NLS-1$ | |||
} | |||
return result; | |||
} | |||
private boolean verifyChecksum( Path file, String fileName, ChecksumAlgorithm digester, Artifact artifact, String key ) | |||
throws IOException | |||
{ | |||
boolean result; | |||
Path checksumFile = file.resolveSibling( fileName ); | |||
// We ignore the check, if the checksum file does not exist | |||
if (!Files.exists(checksumFile)) { | |||
return true; | |||
} | |||
ChecksummedFile csFile = new ChecksummedFile( file ); | |||
try | |||
{ | |||
result = csFile.isValidChecksum( digester, true ); | |||
} catch (ChecksumValidationException e ) { | |||
addWarning( artifact, Messages.getString( key ) ); | |||
result = false; | |||
} | |||
return result; | |||
} | |||
/** | |||
* File extension for checksums | |||
* TODO should be moved to plexus-digester ? | |||
*/ | |||
private String getDigesterFileExtension( ChecksumAlgorithm checksumAlgorithm ) | |||
{ | |||
return checksumAlgorithm.getExt().get(0); | |||
} | |||
private boolean copyArtifact( Artifact artifact, ArtifactRepository targetRepository, FileTransaction transaction ) | |||
throws ArtifactConversionException | |||
{ | |||
Path sourceFile = artifact.getFile().toPath(); | |||
if ( sourceFile.toAbsolutePath().toString().indexOf( "/plugins/" ) > -1 ) //$NON-NLS-1$ | |||
{ | |||
artifact.setArtifactHandler( artifactHandlerManager.getArtifactHandler( "maven-plugin" ) ); //$NON-NLS-1$ | |||
} | |||
Path targetFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); | |||
boolean result = true; | |||
try | |||
{ | |||
boolean matching = false; | |||
if ( !force && Files.exists(targetFile) ) | |||
{ | |||
matching = FileUtils.contentEquals( sourceFile.toFile(), targetFile.toFile() ); | |||
if ( !matching ) | |||
{ | |||
addWarning( artifact, Messages.getString( "failure.target.already.exists" ) ); //$NON-NLS-1$ | |||
result = false; | |||
} | |||
} | |||
if ( result ) | |||
{ | |||
if ( force || !matching ) | |||
{ | |||
if ( testChecksums( artifact, sourceFile ) ) | |||
{ | |||
transaction.copyFile( sourceFile, targetFile, digesters ); | |||
} | |||
else | |||
{ | |||
result = false; | |||
} | |||
} | |||
} | |||
} | |||
catch ( IOException e ) | |||
{ | |||
throw new ArtifactConversionException( Messages.getString( "error.copying.artifact" ), e ); //$NON-NLS-1$ | |||
} | |||
return result; | |||
} | |||
private Metadata createBaseMetadata( Artifact artifact ) | |||
{ | |||
Metadata metadata = new Metadata(); | |||
metadata.setArtifactId( artifact.getArtifactId() ); | |||
metadata.setGroupId( artifact.getGroupId() ); | |||
return metadata; | |||
} | |||
private Metadata readMetadata( Path file ) | |||
throws ArtifactConversionException | |||
{ | |||
MetadataXpp3Reader reader = new MetadataXpp3Reader(); | |||
try (Reader fileReader = Files.newBufferedReader( file, Charset.defaultCharset() )) | |||
{ | |||
return reader.read( fileReader ); | |||
} | |||
catch ( IOException | XmlPullParserException e ) | |||
{ | |||
throw new ArtifactConversionException( Messages.getString( "error.reading.target.metadata" ), | |||
e ); //$NON-NLS-1$ | |||
} | |||
} | |||
private boolean validateMetadata( Artifact artifact ) | |||
throws ArtifactConversionException | |||
{ | |||
ArtifactRepository repository = artifact.getRepository(); | |||
boolean result = true; | |||
RepositoryMetadata repositoryMetadata = new ArtifactRepositoryMetadata( artifact ); | |||
Path file = Paths.get( repository.getBasedir(), repository.pathOfRemoteRepositoryMetadata( repositoryMetadata ) ); | |||
if ( Files.exists(file) ) | |||
{ | |||
Metadata metadata = readMetadata( file ); | |||
result = validateMetadata( metadata, repositoryMetadata, artifact ); | |||
} | |||
repositoryMetadata = new SnapshotArtifactRepositoryMetadata( artifact ); | |||
file = Paths.get( repository.getBasedir(), repository.pathOfRemoteRepositoryMetadata( repositoryMetadata ) ); | |||
if ( Files.exists(file) ) | |||
{ | |||
Metadata metadata = readMetadata( file ); | |||
result = result && validateMetadata( metadata, repositoryMetadata, artifact ); | |||
} | |||
return result; | |||
} | |||
@SuppressWarnings("unchecked") | |||
private boolean validateMetadata( Metadata metadata, RepositoryMetadata repositoryMetadata, Artifact artifact ) | |||
{ | |||
String groupIdKey; | |||
String artifactIdKey = null; | |||
String snapshotKey = null; | |||
String versionKey = null; | |||
String versionsKey = null; | |||
if ( repositoryMetadata.storedInGroupDirectory() ) | |||
{ | |||
groupIdKey = "failure.incorrect.groupMetadata.groupId"; //$NON-NLS-1$ | |||
} | |||
else if ( repositoryMetadata.storedInArtifactVersionDirectory() ) | |||
{ | |||
groupIdKey = "failure.incorrect.snapshotMetadata.groupId"; //$NON-NLS-1$ | |||
artifactIdKey = "failure.incorrect.snapshotMetadata.artifactId"; //$NON-NLS-1$ | |||
versionKey = "failure.incorrect.snapshotMetadata.version"; //$NON-NLS-1$ | |||
snapshotKey = "failure.incorrect.snapshotMetadata.snapshot"; //$NON-NLS-1$ | |||
} | |||
else | |||
{ | |||
groupIdKey = "failure.incorrect.artifactMetadata.groupId"; //$NON-NLS-1$ | |||
artifactIdKey = "failure.incorrect.artifactMetadata.artifactId"; //$NON-NLS-1$ | |||
versionsKey = "failure.incorrect.artifactMetadata.versions"; //$NON-NLS-1$ | |||
} | |||
boolean result = true; | |||
if ( metadata.getGroupId() == null || !metadata.getGroupId().equals( artifact.getGroupId() ) ) | |||
{ | |||
addWarning( artifact, Messages.getString( groupIdKey ) ); | |||
result = false; | |||
} | |||
if ( !repositoryMetadata.storedInGroupDirectory() ) | |||
{ | |||
if ( metadata.getGroupId() == null || !metadata.getArtifactId().equals( artifact.getArtifactId() ) ) | |||
{ | |||
addWarning( artifact, Messages.getString( artifactIdKey ) ); | |||
result = false; | |||
} | |||
if ( !repositoryMetadata.storedInArtifactVersionDirectory() ) | |||
{ | |||
// artifact metadata | |||
boolean foundVersion = false; | |||
if ( metadata.getVersioning() != null ) | |||
{ | |||
for ( String version : (List<String>) metadata.getVersioning().getVersions() ) | |||
{ | |||
if ( version.equals( artifact.getBaseVersion() ) ) | |||
{ | |||
foundVersion = true; | |||
break; | |||
} | |||
} | |||
} | |||
if ( !foundVersion ) | |||
{ | |||
addWarning( artifact, Messages.getString( versionsKey ) ); | |||
result = false; | |||
} | |||
} | |||
else | |||
{ | |||
// snapshot metadata | |||
if ( !artifact.getBaseVersion().equals( metadata.getVersion() ) ) | |||
{ | |||
addWarning( artifact, Messages.getString( versionKey ) ); | |||
result = false; | |||
} | |||
if ( artifact.isSnapshot() ) | |||
{ | |||
Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher( artifact.getVersion() ); | |||
if ( matcher.matches() ) | |||
{ | |||
boolean correct = false; | |||
if ( metadata.getVersioning() != null && metadata.getVersioning().getSnapshot() != null ) | |||
{ | |||
Snapshot snapshot = metadata.getVersioning().getSnapshot(); | |||
int build = Integer.parseInt( matcher.group( 3 ) ); | |||
String ts = matcher.group( 2 ); | |||
if ( build == snapshot.getBuildNumber() && ts.equals( snapshot.getTimestamp() ) ) | |||
{ | |||
correct = true; | |||
} | |||
} | |||
if ( !correct ) | |||
{ | |||
addWarning( artifact, Messages.getString( snapshotKey ) ); | |||
result = false; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
return result; | |||
} | |||
private void updateMetadata( RepositoryMetadata artifactMetadata, ArtifactRepository targetRepository, | |||
Metadata newMetadata, FileTransaction transaction ) | |||
throws ArtifactConversionException | |||
{ | |||
Path file = Paths.get( targetRepository.getBasedir(), | |||
targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) ); | |||
Metadata metadata; | |||
boolean changed; | |||
if ( Files.exists(file) ) | |||
{ | |||
metadata = readMetadata( file ); | |||
changed = metadata.merge( newMetadata ); | |||
} | |||
else | |||
{ | |||
changed = true; | |||
metadata = newMetadata; | |||
} | |||
if ( changed ) | |||
{ | |||
try (StringWriter writer = new StringWriter()) | |||
{ | |||
MetadataXpp3Writer mappingWriter = new MetadataXpp3Writer(); | |||
mappingWriter.write( writer, metadata ); | |||
transaction.createFile( writer.toString(), file, digesters ); | |||
} | |||
catch ( IOException e ) | |||
{ | |||
throw new ArtifactConversionException( Messages.getString( "error.writing.target.metadata" ), | |||
e ); //$NON-NLS-1$ | |||
} | |||
} | |||
} | |||
private boolean doRelocation( Artifact artifact, org.apache.maven.model.v3_0_0.Model v3Model, | |||
ArtifactRepository repository, FileTransaction transaction ) | |||
throws IOException | |||
{ | |||
Properties properties = v3Model.getProperties(); | |||
if ( properties.containsKey( "relocated.groupId" ) || properties.containsKey( "relocated.artifactId" ) | |||
//$NON-NLS-1$ //$NON-NLS-2$ | |||
|| properties.containsKey( "relocated.version" ) ) //$NON-NLS-1$ | |||
{ | |||
String newGroupId = properties.getProperty( "relocated.groupId", v3Model.getGroupId() ); //$NON-NLS-1$ | |||
properties.remove( "relocated.groupId" ); //$NON-NLS-1$ | |||
String newArtifactId = | |||
properties.getProperty( "relocated.artifactId", v3Model.getArtifactId() ); //$NON-NLS-1$ | |||
properties.remove( "relocated.artifactId" ); //$NON-NLS-1$ | |||
String newVersion = properties.getProperty( "relocated.version", v3Model.getVersion() ); //$NON-NLS-1$ | |||
properties.remove( "relocated.version" ); //$NON-NLS-1$ | |||
String message = properties.getProperty( "relocated.message", "" ); //$NON-NLS-1$ //$NON-NLS-2$ | |||
properties.remove( "relocated.message" ); //$NON-NLS-1$ | |||
if ( properties.isEmpty() ) | |||
{ | |||
v3Model.setProperties( null ); | |||
} | |||
writeRelocationPom( v3Model.getGroupId(), v3Model.getArtifactId(), v3Model.getVersion(), newGroupId, | |||
newArtifactId, newVersion, message, repository, transaction ); | |||
v3Model.setGroupId( newGroupId ); | |||
v3Model.setArtifactId( newArtifactId ); | |||
v3Model.setVersion( newVersion ); | |||
artifact.setGroupId( newGroupId ); | |||
artifact.setArtifactId( newArtifactId ); | |||
artifact.setVersion( newVersion ); | |||
return true; | |||
} | |||
else | |||
{ | |||
return false; | |||
} | |||
} | |||
private void writeRelocationPom( String groupId, String artifactId, String version, String newGroupId, | |||
String newArtifactId, String newVersion, String message, | |||
ArtifactRepository repository, FileTransaction transaction ) | |||
throws IOException | |||
{ | |||
Model pom = new Model(); | |||
pom.setGroupId( groupId ); | |||
pom.setArtifactId( artifactId ); | |||
pom.setVersion( version ); | |||
DistributionManagement dMngt = new DistributionManagement(); | |||
Relocation relocation = new Relocation(); | |||
relocation.setGroupId( newGroupId ); | |||
relocation.setArtifactId( newArtifactId ); | |||
relocation.setVersion( newVersion ); | |||
if ( message != null && message.length() > 0 ) | |||
{ | |||
relocation.setMessage( message ); | |||
} | |||
dMngt.setRelocation( relocation ); | |||
pom.setDistributionManagement( dMngt ); | |||
Artifact artifact = artifactFactory.createBuildArtifact( groupId, artifactId, version, "pom" ); //$NON-NLS-1$ | |||
Path pomFile = Paths.get( repository.getBasedir(), repository.pathOf( artifact ) ); | |||
StringWriter strWriter = new StringWriter(); | |||
MavenXpp3Writer pomWriter = new MavenXpp3Writer(); | |||
pomWriter.write( strWriter, pom ); | |||
transaction.createFile( strWriter.toString(), pomFile, digesters ); | |||
} | |||
private void addWarning( Artifact artifact, String message ) | |||
{ | |||
List<String> messages = warnings.get( artifact ); | |||
if ( messages == null ) | |||
{ | |||
messages = new ArrayList<>( 1 ); | |||
} | |||
messages.add( message ); | |||
warnings.put( artifact, messages ); | |||
} | |||
@Override | |||
public void clearWarnings() | |||
{ | |||
warnings.clear(); | |||
} | |||
@Override | |||
public Map<Artifact, List<String>> getWarnings() | |||
{ | |||
return warnings; | |||
} | |||
public List<ChecksumAlgorithm> getDigesters() | |||
{ | |||
return digesters; | |||
} | |||
public void setDigesters( List<ChecksumAlgorithm> digesters ) | |||
{ | |||
this.digesters = digesters; | |||
} | |||
public ModelConverter getTranslator() | |||
{ | |||
return translator; | |||
} | |||
public void setTranslator( ModelConverter translator ) | |||
{ | |||
this.translator = translator; | |||
} | |||
public ArtifactFactory getArtifactFactory() | |||
{ | |||
return artifactFactory; | |||
} | |||
public void setArtifactFactory( ArtifactFactory artifactFactory ) | |||
{ | |||
this.artifactFactory = artifactFactory; | |||
} | |||
public ArtifactHandlerManager getArtifactHandlerManager() | |||
{ | |||
return artifactHandlerManager; | |||
} | |||
public void setArtifactHandlerManager( ArtifactHandlerManager artifactHandlerManager ) | |||
{ | |||
this.artifactHandlerManager = artifactHandlerManager; | |||
} | |||
public boolean isForce() | |||
{ | |||
return force; | |||
} | |||
public void setForce( boolean force ) | |||
{ | |||
this.force = force; | |||
} | |||
public boolean isDryrun() | |||
{ | |||
return dryrun; | |||
} | |||
public void setDryrun( boolean dryrun ) | |||
{ | |||
this.dryrun = dryrun; | |||
} | |||
} |
@@ -1,71 +0,0 @@ | |||
package org.apache.archiva.converter.artifact; | |||
/* | |||
* 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. | |||
*/ | |||
import java.text.MessageFormat; | |||
import java.util.MissingResourceException; | |||
import java.util.ResourceBundle; | |||
/** | |||
* Messages | |||
* | |||
* | |||
*/ | |||
public class Messages | |||
{ | |||
private static final String BUNDLE_NAME = "org.apache.archiva.converter.artifact.messages"; //$NON-NLS-1$ | |||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME ); | |||
private Messages() | |||
{ | |||
// no op | |||
} | |||
public static String getString( String key ) | |||
{ | |||
try | |||
{ | |||
return RESOURCE_BUNDLE.getString( key ); | |||
} | |||
catch ( MissingResourceException e ) | |||
{ | |||
return '!' + key + '!'; | |||
} | |||
} | |||
public static String getString( String key, Object argument ) | |||
{ | |||
return getString( key, new Object[] { argument } ); | |||
} | |||
public static String getString( String key, Object arguments[] ) | |||
{ | |||
try | |||
{ | |||
String pattern = RESOURCE_BUNDLE.getString( key ); | |||
return MessageFormat.format( pattern, arguments ); | |||
} | |||
catch ( MissingResourceException e ) | |||
{ | |||
return '!' + key + '!'; | |||
} | |||
} | |||
} |
@@ -1,106 +0,0 @@ | |||
package org.apache.archiva.converter.artifact; | |||
/* | |||
* 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. | |||
*/ | |||
import org.apache.maven.artifact.Artifact; | |||
import org.apache.maven.artifact.repository.ArtifactRepository; | |||
import org.apache.maven.artifact.repository.metadata.AbstractRepositoryMetadata; | |||
import org.apache.maven.artifact.repository.metadata.Snapshot; | |||
/** | |||
* | |||
* This is a copy of org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata | |||
* from the maven-compat module, because this is the only class that we use from the compat module and | |||
* we can get rid of the dependency. | |||
* | |||
* Metadata for the artifact version directory of the repository. | |||
* | |||
* | |||
* @author <a href="mailto:brett@apache.org">Brett Porter</a> | |||
* | |||
*/ | |||
public class SnapshotArtifactRepositoryMetadata | |||
extends AbstractRepositoryMetadata | |||
{ | |||
private Artifact artifact; | |||
public SnapshotArtifactRepositoryMetadata( Artifact artifact ) | |||
{ | |||
super( createMetadata( artifact, null ) ); | |||
this.artifact = artifact; | |||
} | |||
public SnapshotArtifactRepositoryMetadata( Artifact artifact, | |||
Snapshot snapshot ) | |||
{ | |||
super( createMetadata( artifact, createVersioning( snapshot ) ) ); | |||
this.artifact = artifact; | |||
} | |||
public boolean storedInGroupDirectory() | |||
{ | |||
return false; | |||
} | |||
public boolean storedInArtifactVersionDirectory() | |||
{ | |||
return true; | |||
} | |||
public String getGroupId() | |||
{ | |||
return artifact.getGroupId(); | |||
} | |||
public String getArtifactId() | |||
{ | |||
return artifact.getArtifactId(); | |||
} | |||
public String getBaseVersion() | |||
{ | |||
return artifact.getBaseVersion(); | |||
} | |||
public Object getKey() | |||
{ | |||
return "snapshot " + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getBaseVersion(); | |||
} | |||
public boolean isSnapshot() | |||
{ | |||
return artifact.isSnapshot(); | |||
} | |||
public int getNature() | |||
{ | |||
return isSnapshot() ? SNAPSHOT : RELEASE; | |||
} | |||
public ArtifactRepository getRepository() | |||
{ | |||
return artifact.getRepository(); | |||
} | |||
public void setRepository( ArtifactRepository remoteRepository ) | |||
{ | |||
artifact.setRepository( remoteRepository ); | |||
} | |||
} |
@@ -1,128 +0,0 @@ | |||
package org.apache.archiva.converter.legacy; | |||
/* | |||
* 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. | |||
*/ | |||
import org.apache.archiva.common.filelock.DefaultFileLockManager; | |||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; | |||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; | |||
import org.apache.archiva.common.utils.PathUtil; | |||
import org.apache.archiva.configuration.FileTypes; | |||
import org.apache.archiva.consumers.InvalidRepositoryContentConsumer; | |||
import org.apache.archiva.consumers.KnownRepositoryContentConsumer; | |||
import org.apache.archiva.converter.RepositoryConversionException; | |||
import org.apache.archiva.repository.base.BasicManagedRepository; | |||
import org.apache.archiva.repository.storage.FilesystemStorage; | |||
import org.apache.archiva.repository.content.maven2.ManagedDefaultRepositoryContent; | |||
import org.apache.archiva.repository.scanner.RepositoryScanner; | |||
import org.apache.archiva.repository.scanner.RepositoryScannerException; | |||
import org.apache.maven.artifact.repository.ArtifactRepository; | |||
import org.apache.maven.artifact.repository.MavenArtifactRepository; | |||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; | |||
import org.springframework.stereotype.Service; | |||
import javax.inject.Inject; | |||
import javax.inject.Named; | |||
import java.io.IOException; | |||
import java.nio.file.Path; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.Collections; | |||
import java.util.List; | |||
/** | |||
* DefaultLegacyRepositoryConverter | |||
* | |||
* | |||
*/ | |||
@Service( "legacyRepositoryConverter#default" ) | |||
public class DefaultLegacyRepositoryConverter | |||
implements LegacyRepositoryConverter | |||
{ | |||
/** | |||
* | |||
*/ | |||
// private ArtifactRepositoryFactory artifactRepositoryFactory; | |||
/** | |||
* | |||
*/ | |||
private ArtifactRepositoryLayout defaultLayout; | |||
@Inject | |||
FileTypes fileTypes; | |||
/** | |||
* | |||
*/ | |||
@Inject | |||
@Named( value = "knownRepositoryContentConsumer#artifact-legacy-to-default-converter" ) | |||
private LegacyConverterArtifactConsumer legacyConverterConsumer; | |||
/** | |||
* | |||
*/ | |||
@Inject | |||
private RepositoryScanner repoScanner; | |||
@Inject | |||
public DefaultLegacyRepositoryConverter( PlexusSisuBridge plexusSisuBridge ) | |||
throws PlexusSisuBridgeException | |||
{ | |||
// artifactRepositoryFactory = plexusSisuBridge.lookup( ArtifactRepositoryFactory.class ); | |||
defaultLayout = plexusSisuBridge.lookup( ArtifactRepositoryLayout.class, "default" ); | |||
} | |||
@Override | |||
public void convertLegacyRepository( Path legacyRepositoryDirectory, Path repositoryDirectory, | |||
List<String> fileExclusionPatterns ) | |||
throws RepositoryConversionException | |||
{ | |||
try | |||
{ | |||
String defaultRepositoryUrl = PathUtil.toUrl( repositoryDirectory ); | |||
BasicManagedRepository legacyRepository = BasicManagedRepository.newFilesystemInstance( "legacy", "Legacy Repository", repositoryDirectory); | |||
legacyRepository.setLocation( legacyRepositoryDirectory.toAbsolutePath().toUri() ); | |||
legacyRepository.setLayout( "legacy" ); | |||
DefaultFileLockManager lockManager = new DefaultFileLockManager(); | |||
FilesystemStorage storage = new FilesystemStorage(legacyRepositoryDirectory, lockManager); | |||
legacyRepository.setContent(new ManagedDefaultRepositoryContent(legacyRepository, fileTypes, lockManager)); | |||
ArtifactRepository repository = | |||
new MavenArtifactRepository("default", defaultRepositoryUrl, defaultLayout, null, null); | |||
legacyConverterConsumer.setExcludes( fileExclusionPatterns ); | |||
legacyConverterConsumer.setDestinationRepository( repository ); | |||
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<>( 1 ); | |||
knownConsumers.add( legacyConverterConsumer ); | |||
List<InvalidRepositoryContentConsumer> invalidConsumers = Collections.emptyList(); | |||
List<String> ignoredContent = new ArrayList<String>( Arrays.asList( RepositoryScanner.IGNORABLE_CONTENT ) ); | |||
repoScanner.scan( legacyRepository, knownConsumers, invalidConsumers, ignoredContent, | |||
RepositoryScanner.FRESH_SCAN ); | |||
} | |||
catch (RepositoryScannerException | IOException e ) | |||
{ | |||
throw new RepositoryConversionException( "Error convering legacy repository.", e ); | |||
} | |||
} | |||
} |
@@ -1,197 +0,0 @@ | |||
package org.apache.archiva.converter.legacy; | |||
/* | |||
* 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. | |||
*/ | |||
import org.apache.archiva.common.filelock.FileLockManager; | |||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; | |||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; | |||
import org.apache.archiva.configuration.FileTypes; | |||
import org.apache.archiva.consumers.AbstractMonitoredConsumer; | |||
import org.apache.archiva.consumers.ConsumerException; | |||
import org.apache.archiva.consumers.KnownRepositoryContentConsumer; | |||
import org.apache.archiva.converter.artifact.ArtifactConversionException; | |||
import org.apache.archiva.converter.artifact.ArtifactConverter; | |||
import org.apache.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider; | |||
import org.apache.archiva.model.ArtifactReference; | |||
import org.apache.archiva.repository.LayoutException; | |||
import org.apache.archiva.repository.ManagedRepository; | |||
import org.apache.archiva.repository.ManagedRepositoryContent; | |||
import org.apache.archiva.repository.content.maven2.ManagedDefaultRepositoryContent; | |||
import org.apache.maven.artifact.Artifact; | |||
import org.apache.maven.artifact.factory.ArtifactFactory; | |||
import org.apache.maven.artifact.repository.ArtifactRepository; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.context.annotation.Scope; | |||
import org.springframework.stereotype.Service; | |||
import javax.inject.Inject; | |||
import javax.inject.Named; | |||
import java.util.ArrayList; | |||
import java.util.Date; | |||
import java.util.List; | |||
/** | |||
* LegacyConverterArtifactConsumer - convert artifacts as they are found | |||
* into the destination repository. | |||
* | |||
* | |||
*/ | |||
@Service( "knownRepositoryContentConsumer#artifact-legacy-to-default-converter" ) | |||
@Scope( "prototype" ) | |||
public class LegacyConverterArtifactConsumer | |||
extends AbstractMonitoredConsumer | |||
implements KnownRepositoryContentConsumer | |||
{ | |||
private Logger log = LoggerFactory.getLogger( LegacyConverterArtifactConsumer.class ); | |||
@Inject | |||
@Named("artifactConverter#legacy-to-default") | |||
private ArtifactConverter artifactConverter; | |||
@Inject | |||
private List<? extends ArtifactMappingProvider> artifactMappingProviders; | |||
@Inject | |||
private FileTypes fileTypes; | |||
@Inject | |||
private FileLockManager fileLockManager; | |||
private ArtifactFactory artifactFactory; | |||
private ManagedRepositoryContent managedRepository; | |||
private ArtifactRepository destinationRepository; | |||
private List<String> includes; | |||
private List<String> excludes; | |||
@Inject | |||
public LegacyConverterArtifactConsumer( PlexusSisuBridge plexusSisuBridge ) | |||
throws PlexusSisuBridgeException | |||
{ | |||
includes = new ArrayList<>( 3 ); | |||
includes.add( "**/*.jar" ); | |||
includes.add( "**/*.ear" ); | |||
includes.add( "**/*.war" ); | |||
artifactFactory = plexusSisuBridge.lookup( ArtifactFactory.class ); | |||
} | |||
@Override | |||
public void beginScan( ManagedRepository repository, Date whenGathered ) | |||
throws ConsumerException | |||
{ | |||
this.managedRepository = new ManagedDefaultRepositoryContent(repository, artifactMappingProviders, fileTypes, fileLockManager); | |||
} | |||
@Override | |||
public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo ) | |||
throws ConsumerException | |||
{ | |||
beginScan( repository, whenGathered ); | |||
} | |||
@Override | |||
public void completeScan() | |||
{ | |||
// no op | |||
} | |||
@Override | |||
public void completeScan( boolean executeOnEntireRepo ) | |||
{ | |||
completeScan(); | |||
} | |||
@Override | |||
public List<String> getExcludes() | |||
{ | |||
return excludes; | |||
} | |||
@Override | |||
public List<String> getIncludes() | |||
{ | |||
return includes; | |||
} | |||
@Override | |||
public void processFile( String path ) | |||
throws ConsumerException | |||
{ | |||
try | |||
{ | |||
ArtifactReference reference = managedRepository.toArtifactReference( path ); | |||
Artifact artifact = artifactFactory.createArtifact( reference.getGroupId(), reference.getArtifactId(), | |||
reference.getVersion(), reference.getClassifier(), | |||
reference.getType() ); | |||
artifactConverter.convert( artifact, destinationRepository ); | |||
} | |||
catch ( LayoutException e ) | |||
{ | |||
log.warn( "Unable to convert artifact: {} : {}",path , e.getMessage(), e ); | |||
} | |||
catch ( ArtifactConversionException e ) | |||
{ | |||
log.warn( "Unable to convert artifact: {} : {}",path , e.getMessage(), e ); | |||
} | |||
} | |||
@Override | |||
public void processFile( String path, boolean executeOnEntireRepo ) | |||
throws Exception | |||
{ | |||
processFile( path ); | |||
} | |||
@Override | |||
public String getDescription() | |||
{ | |||
return "Legacy Artifact to Default Artifact Converter"; | |||
} | |||
@Override | |||
public String getId() | |||
{ | |||
return "artifact-legacy-to-default-converter"; | |||
} | |||
public void setExcludes( List<String> excludes ) | |||
{ | |||
this.excludes = excludes; | |||
} | |||
public void setIncludes( List<String> includes ) | |||
{ | |||
this.includes = includes; | |||
} | |||
public ArtifactRepository getDestinationRepository() | |||
{ | |||
return destinationRepository; | |||
} | |||
public void setDestinationRepository( ArtifactRepository destinationRepository ) | |||
{ | |||
this.destinationRepository = destinationRepository; | |||
} | |||
} |
@@ -1,45 +0,0 @@ | |||
package org.apache.archiva.converter.legacy; | |||
/* | |||
* 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. | |||
*/ | |||
import org.apache.archiva.converter.RepositoryConversionException; | |||
import java.nio.file.Path; | |||
import java.util.List; | |||
/** | |||
* Convert an entire repository. | |||
*/ | |||
public interface LegacyRepositoryConverter | |||
{ | |||
/** | |||
* Convert a legacy repository to a modern repository. This means a Maven 1.x repository | |||
* using v3 POMs to a Maven 2.x repository using v4.0.0 POMs. | |||
* | |||
* @param legacyRepositoryDirectory the directory of the legacy repository. | |||
* @param destinationRepositoryDirectory the directory of the modern repository. | |||
* @param fileExclusionPatterns the list of patterns to exclude from the conversion. | |||
* @throws RepositoryConversionException | |||
*/ | |||
void convertLegacyRepository( Path legacyRepositoryDirectory, Path destinationRepositoryDirectory, | |||
List<String> fileExclusionPatterns ) | |||
throws RepositoryConversionException; | |||
} |
@@ -1,33 +0,0 @@ | |||
<?xml version="1.0"?> | |||
<!-- | |||
~ 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. | |||
--> | |||
<beans xmlns="http://www.springframework.org/schema/beans" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xmlns:context="http://www.springframework.org/schema/context" | |||
xsi:schemaLocation="http://www.springframework.org/schema/beans | |||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd | |||
http://www.springframework.org/schema/context | |||
http://www.springframework.org/schema/context/spring-context-3.0.xsd" | |||
default-lazy-init="true"> | |||
<context:annotation-config/> | |||
<context:component-scan base-package="org.apache.archiva.converter"/> | |||
</beans> |
@@ -1,38 +0,0 @@ | |||
# | |||
# 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. | |||
# | |||
failure.incorrect.md5=The MD5 checksum value was incorrect. | |||
failure.incorrect.sha1=The SHA1 checksum value was incorrect. | |||
failure.target.already.exists=The artifact could not be converted because it already exists. | |||
failure.invalid.source.pom=The source POM was invalid: {0}. | |||
warning.missing.pom=The artifact had no POM in the source repository. | |||
exception.repositories.match=Source and target repositories are identical. | |||
failure.incorrect.groupMetadata.groupId=The group ID in the source group metadata is incorrect. | |||
failure.incorrect.artifactMetadata.artifactId=The artifact ID in the source artifact metadata is incorrect. | |||
failure.incorrect.artifactMetadata.groupId=The group ID in the source artifact metadata is incorrect. | |||
failure.incorrect.artifactMetadata.versions=The version list in the source artifact metadata is incorrect. | |||
failure.incorrect.snapshotMetadata.artifactId=The artifact ID in the source artifact version metadata is incorrect. | |||
failure.incorrect.snapshotMetadata.groupId=The group ID in the source artifact version metadata is incorrect. | |||
failure.incorrect.snapshotMetadata.version=The version in the source artifact version metadata is incorrect. | |||
failure.incorrect.snapshotMetadata.snapshot=The snapshot information in the source artifact version metadata is incorrect. |
@@ -1,51 +0,0 @@ | |||
# | |||
# 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. | |||
# | |||
unable.to.validate.metadata=Unable to validate metadata | |||
unable.to.copy.pom=Unable to copy pom. | |||
unable.to.copy.artifact=Unable to copy artifact | |||
unable.to.read.source.pom=Unable to read source POM: {0} | |||
unable.to.write.target.pom=Unable to write target POM: {0} | |||
unable.to.write.converted.pom=Unable to write converted POM | |||
exception.repositories.match=Source repository of artifact, and target repository are the same. No conversion needed. | |||
transaction.failure=Transaction failure: {0} | |||
invalid.source.pom=Invalid source pom: {0} | |||
warning.missing.pom=The artifact had no POM in the source repository. | |||
error.copying.artifact=Error copying artifact | |||
error.reading.target.metadata=Error reading target metadata | |||
error.writing.target.metadata=Error writing target metadata | |||
failure.target.already.exists=The artifact could not be converted because it already exists. | |||
failure.incorrect.groupMetadata.groupId=The group ID in the source group metadata is incorrect. | |||
failure.incorrect.artifactMetadata.artifactId=The artifact ID in the source artifact metadata is incorrect. | |||
failure.incorrect.artifactMetadata.groupId=The group ID in the source artifact metadata is incorrect. | |||
failure.incorrect.artifactMetadata.versions=The version list in the source artifact metadata is incorrect. | |||
failure.incorrect.snapshotMetadata.artifactId=The artifact ID in the source artifact version metadata is incorrect. | |||
failure.incorrect.snapshotMetadata.groupId=The group ID in the source artifact version metadata is incorrect. | |||
failure.incorrect.snapshotMetadata.version=The version in the source artifact version metadata is incorrect. | |||
failure.incorrect.snapshotMetadata.snapshot=The snapshot information in the source artifact version metadata is incorrect. | |||
failure.incorrect.md5=The MD5 checksum value was incorrect. | |||
failure.incorrect.sha1=The SHA1 checksum value was incorrect. |
@@ -1,6 +0,0 @@ | |||
<project> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>test</groupId> | |||
<artifactId>artifact-one</artifactId> | |||
<version>1.0.0</version> | |||
</project> |
@@ -1,6 +0,0 @@ | |||
<project> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>test</groupId> | |||
<artifactId>artifact-three</artifactId> | |||
<version>1.0.0</version> | |||
</project> |
@@ -1,6 +0,0 @@ | |||
<project> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>test</groupId> | |||
<artifactId>artifact-two</artifactId> | |||
<version>1.0.0</version> | |||
</project> |
@@ -1,29 +0,0 @@ | |||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>test</groupId> | |||
<artifactId>v3artifact</artifactId> | |||
<version>1.0.0-SNAPSHOT</version> | |||
<scm> | |||
<connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection> | |||
</scm> | |||
<dependencies> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>artifactId</artifactId> | |||
<version>version</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>test-artifactId</artifactId> | |||
<version>version</version> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>junit</groupId> | |||
<artifactId>junit</artifactId> | |||
<version>3.8.2</version> | |||
<scope>test</scope> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1,29 +0,0 @@ | |||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>test</groupId> | |||
<artifactId>v3artifact</artifactId> | |||
<version>1.0.0-20060105.130101-3</version> | |||
<scm> | |||
<connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection> | |||
</scm> | |||
<dependencies> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>artifactId</artifactId> | |||
<version>version</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>test-artifactId</artifactId> | |||
<version>version</version> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>junit</groupId> | |||
<artifactId>junit</artifactId> | |||
<version>3.8.2</version> | |||
<scope>test</scope> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1,29 +0,0 @@ | |||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>test</groupId> | |||
<artifactId>v3-warnings-artifact</artifactId> | |||
<version>1.0.0</version> | |||
<scm> | |||
<connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection> | |||
</scm> | |||
<dependencies> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>artifactId</artifactId> | |||
<version>version</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>test-artifactId</artifactId> | |||
<version>version</version> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>junit</groupId> | |||
<artifactId>junit</artifactId> | |||
<version>3.8.2</version> | |||
<scope>test</scope> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1,29 +0,0 @@ | |||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>test</groupId> | |||
<artifactId>v3artifact</artifactId> | |||
<version>1.0.0</version> | |||
<scm> | |||
<connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection> | |||
</scm> | |||
<dependencies> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>artifactId</artifactId> | |||
<version>version</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>test-artifactId</artifactId> | |||
<version>version</version> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>junit</groupId> | |||
<artifactId>junit</artifactId> | |||
<version>3.8.2</version> | |||
<scope>test</scope> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1,7 +0,0 @@ | |||
<project> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<artifactId>maven-foo-plugin</artifactId> | |||
<version>1.0.0</version> | |||
<packaging>maven-plugin</version> | |||
</project> |
@@ -1,10 +0,0 @@ | |||
<metadata> | |||
<groupId>test</groupId> | |||
<artifactId>newversion-artifact</artifactId> | |||
<versioning> | |||
<versions> | |||
<version>1.0.0</version> | |||
<version>1.0.1</version> | |||
</versions> | |||
</versioning> | |||
</metadata> |
@@ -1,6 +0,0 @@ | |||
<metadata> | |||
<groupId>relocated-test</groupId> | |||
<artifactId>relocated-v3artifact</artifactId> | |||
<version>1.0.0</version> | |||
<versioning /> | |||
</metadata> |
@@ -1 +0,0 @@ | |||
v3 |
@@ -1,29 +0,0 @@ | |||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>relocated-test</groupId> | |||
<artifactId>relocated-v3artifact</artifactId> | |||
<version>1.0.0</version> | |||
<scm> | |||
<connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection> | |||
</scm> | |||
<dependencies> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>artifactId</artifactId> | |||
<version>version</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>test-artifactId</artifactId> | |||
<version>version</version> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>junit</groupId> | |||
<artifactId>junit</artifactId> | |||
<version>3.8.2</version> | |||
<scope>test</scope> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1,9 +0,0 @@ | |||
<metadata> | |||
<groupId>relocated-test</groupId> | |||
<artifactId>relocated-v3artifact</artifactId> | |||
<versioning> | |||
<versions> | |||
<version>1.0.0</version> | |||
</versions> | |||
</versioning> | |||
</metadata> |
@@ -1,13 +0,0 @@ | |||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
<groupId>test</groupId> | |||
<artifactId>relocated-v3artifact</artifactId> | |||
<version>1.0.0</version> | |||
<distributionManagement> | |||
<relocation> | |||
<groupId>relocated-test</groupId> | |||
<artifactId>relocated-v3artifact</artifactId> | |||
<version>1.0.0</version> | |||
</relocation> | |||
</distributionManagement> | |||
</project> |
@@ -1,9 +0,0 @@ | |||
<metadata> | |||
<groupId>test</groupId> | |||
<artifactId>v3artifact</artifactId> | |||
<versioning> | |||
<versions> | |||
<version>1.0.0</version> | |||
</versions> | |||
</versioning> | |||
</metadata> |
@@ -1,9 +0,0 @@ | |||
<metadata> | |||
<groupId>test</groupId> | |||
<artifactId>v3artifact</artifactId> | |||
<versioning> | |||
<versions> | |||
<version>1.0.0-SNAPSHOT</version> | |||
</versions> | |||
</versioning> | |||
</metadata> |
@@ -1,6 +0,0 @@ | |||
<metadata> | |||
<groupId>test</groupId> | |||
<artifactId>v3artifact</artifactId> | |||
<version>1.0.0-SNAPSHOT</version> | |||
<versioning /> | |||
</metadata> |
@@ -1,11 +0,0 @@ | |||
<metadata> | |||
<groupId>test</groupId> | |||
<artifactId>v3artifact</artifactId> | |||
<version>1.0.0-SNAPSHOT</version> | |||
<versioning> | |||
<snapshot> | |||
<timestamp>20060105.130101</timestamp> | |||
<buildNumber>3</buildNumber> | |||
</snapshot> | |||
</versioning> | |||
</metadata> |
@@ -1,6 +0,0 @@ | |||
<metadata> | |||
<groupId>test</groupId> | |||
<artifactId>v3artifact</artifactId> | |||
<version>1.0.0</version> | |||
<versioning /> | |||
</metadata> |
@@ -1,9 +0,0 @@ | |||
<metadata> | |||
<groupId>test</groupId> | |||
<artifactId>v4artifact</artifactId> | |||
<versioning> | |||
<versions> | |||
<version>1.0.0</version> | |||
</versions> | |||
</versioning> | |||
</metadata> |
@@ -1,9 +0,0 @@ | |||
<metadata> | |||
<groupId>test</groupId> | |||
<artifactId>v4artifact</artifactId> | |||
<versioning> | |||
<versions> | |||
<version>1.0.0-SNAPSHOT</version> | |||
</versions> | |||
</versioning> | |||
</metadata> |
@@ -1,6 +0,0 @@ | |||
<metadata> | |||
<groupId>test</groupId> | |||
<artifactId>v4artifact</artifactId> | |||
<version>1.0.0-SNAPSHOT</version> | |||
<versioning /> | |||
</metadata> |
@@ -1,11 +0,0 @@ | |||
<metadata> | |||
<groupId>test</groupId> | |||
<artifactId>v4artifact</artifactId> | |||
<version>1.0.0-SNAPSHOT</version> | |||
<versioning> | |||
<snapshot> | |||
<timestamp>20060111.120115</timestamp> | |||
<buildNumber>1</buildNumber> | |||
</snapshot> | |||
</versioning> | |||
</metadata> |
@@ -1,6 +0,0 @@ | |||
<metadata> | |||
<groupId>test</groupId> | |||
<artifactId>v4artifact</artifactId> | |||
<version>1.0.0</version> | |||
<versioning /> | |||
</metadata> |
@@ -1,164 +0,0 @@ | |||
package org.apache.archiva.converter; | |||
/* | |||
* 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. | |||
*/ | |||
import junit.framework.TestCase; | |||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; | |||
import org.apache.archiva.configuration.ManagedRepositoryConfiguration; | |||
import org.apache.archiva.converter.artifact.LegacyRepositoryLayout; | |||
import org.apache.archiva.converter.legacy.LegacyRepositoryConverter; | |||
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; | |||
import org.apache.commons.io.FileUtils; | |||
import org.apache.maven.artifact.repository.ArtifactRepository; | |||
import org.apache.maven.artifact.repository.MavenArtifactRepository; | |||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import org.junit.runner.RunWith; | |||
import org.springframework.test.context.ContextConfiguration; | |||
import javax.inject.Inject; | |||
import javax.inject.Named; | |||
import java.io.IOException; | |||
import java.nio.file.Files; | |||
import java.nio.file.Path; | |||
import java.nio.file.Paths; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
/** | |||
* Test the repository converter. | |||
* | |||
* @todo what about deletions from the source repository? | |||
* @todo use artifact-test instead | |||
* @todo should reject if dependencies are missing - rely on reporting? | |||
* @todo group metadata | |||
*/ | |||
@RunWith( ArchivaSpringJUnit4ClassRunner.class ) | |||
@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml","classpath:/spring-context.xml"} ) | |||
public class RepositoryConverterTest | |||
extends TestCase | |||
{ | |||
private ArtifactRepository sourceRepository; | |||
private ManagedRepositoryConfiguration targetRepository; | |||
@Inject | |||
@Named(value = "legacyRepositoryConverter#default") | |||
private LegacyRepositoryConverter repositoryConverter; | |||
@Inject | |||
PlexusSisuBridge plexusSisuBridge; | |||
@Before | |||
@Override | |||
public void setUp() | |||
throws Exception | |||
{ | |||
super.setUp(); | |||
// ArtifactRepositoryFactory factory = plexusSisuBridge.lookup( ArtifactRepositoryFactory.class ); | |||
//(ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE ); | |||
ArtifactRepositoryLayout layout = new LegacyRepositoryLayout(); | |||
//(ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "legacy" ); | |||
Path sourceBase = Paths.get( "src/test/source-repository" ); | |||
sourceRepository = new MavenArtifactRepository( "source", sourceBase.toUri().toURL().toString(), layout, null, | |||
null ); | |||
layout = plexusSisuBridge.lookup( ArtifactRepositoryLayout.class, "default" ); | |||
//(ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" ); | |||
Path targetBase = Paths.get( "target/test-target-repository" ); | |||
copyDirectoryStructure( Paths.get( "src/test/target-repository" ), targetBase ); | |||
targetRepository = new ManagedRepositoryConfiguration(); | |||
targetRepository.setId( "target" ); | |||
targetRepository.setName( "Target Repo" ); | |||
targetRepository.setLocation( targetBase.toAbsolutePath().toString() ); | |||
targetRepository.setLayout( "default" ); | |||
//repositoryConverter = (LegacyRepositoryConverter) lookup( LegacyRepositoryConverter.ROLE, "default" ); | |||
} | |||
@Override | |||
protected void tearDown() | |||
throws Exception | |||
{ | |||
super.tearDown(); | |||
} | |||
private void copyDirectoryStructure( Path sourceDirectory, Path destinationDirectory ) | |||
throws IOException | |||
{ | |||
if ( !Files.exists(sourceDirectory) ) | |||
{ | |||
throw new IOException( "Source directory doesn't exists (" + sourceDirectory.toAbsolutePath() + ")." ); | |||
} | |||
Path[] files = Files.list(sourceDirectory).toArray(Path[]::new); | |||
String sourcePath = sourceDirectory.toAbsolutePath().toString(); | |||
for ( int i = 0; i < files.length; i++ ) | |||
{ | |||
Path file = files[i]; | |||
String dest = file.toAbsolutePath().toString(); | |||
dest = dest.substring( sourcePath.length() + 1 ); | |||
Path destination = destinationDirectory.resolve( dest ); | |||
if ( Files.isRegularFile(file) ) | |||
{ | |||
destination = destination.getParent(); | |||
FileUtils.copyFileToDirectory( file.toFile(), destination.toFile() ); | |||
} | |||
else if ( Files.isDirectory(file) ) | |||
{ | |||
if ( !".svn".equals( file.getFileName().toString() ) ) | |||
{ | |||
if ( !Files.exists(destination)) | |||
{ | |||
Files.createDirectories( destination ); | |||
} | |||
copyDirectoryStructure( file, destination ); | |||
} | |||
} | |||
else | |||
{ | |||
throw new IOException( "Unknown file type: " + file.toAbsolutePath() ); | |||
} | |||
} | |||
} | |||
@Test | |||
public void testLegacyConversion() | |||
throws IOException, RepositoryConversionException | |||
{ | |||
Path legacyRepoDir = Paths.get( sourceRepository.getBasedir() ); | |||
Path destRepoDir = Paths.get( targetRepository.getLocation() ); | |||
List<String> excludes = new ArrayList<>(); | |||
repositoryConverter.convertLegacyRepository( legacyRepoDir, destRepoDir, excludes ); | |||
} | |||
} |
@@ -1,199 +0,0 @@ | |||
package org.apache.archiva.converter.mock; | |||
/* | |||
* 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. | |||
*/ | |||
import org.apache.archiva.admin.model.AuditInformation; | |||
import org.apache.archiva.admin.model.RepositoryAdminException; | |||
import org.apache.archiva.admin.model.admin.ArchivaAdministration; | |||
import org.apache.archiva.admin.model.beans.FileType; | |||
import org.apache.archiva.admin.model.beans.LegacyArtifactPath; | |||
import org.apache.archiva.admin.model.beans.NetworkConfiguration; | |||
import org.apache.archiva.admin.model.beans.OrganisationInformation; | |||
import org.apache.archiva.admin.model.beans.UiConfiguration; | |||
import java.util.List; | |||
/** | |||
* @author Olivier Lamy | |||
*/ | |||
public class MockArchivaAdministration | |||
implements ArchivaAdministration | |||
{ | |||
@Override | |||
public List<LegacyArtifactPath> getLegacyArtifactPaths() | |||
throws RepositoryAdminException | |||
{ | |||
return null; | |||
} | |||
@Override | |||
public void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath, AuditInformation auditInformation ) | |||
throws RepositoryAdminException | |||
{ | |||
} | |||
@Override | |||
public void deleteLegacyArtifactPath( String path, AuditInformation auditInformation ) | |||
throws RepositoryAdminException | |||
{ | |||
} | |||
@Override | |||
public void addFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation ) | |||
throws RepositoryAdminException | |||
{ | |||
} | |||
@Override | |||
public void removeFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation ) | |||
throws RepositoryAdminException | |||
{ | |||
} | |||
@Override | |||
public List<FileType> getFileTypes() | |||
throws RepositoryAdminException | |||
{ | |||
return null; | |||
} | |||
@Override | |||
public FileType getFileType( String fileTypeId ) | |||
throws RepositoryAdminException | |||
{ | |||
return null; | |||
} | |||
@Override | |||
public void addFileType( FileType fileType, AuditInformation auditInformation ) | |||
throws RepositoryAdminException | |||
{ | |||
} | |||
@Override | |||
public void removeFileType( String fileTypeId, AuditInformation auditInformation ) | |||
throws RepositoryAdminException | |||
{ | |||
} | |||
@Override | |||
public void addKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation ) | |||
throws RepositoryAdminException | |||
{ | |||
} | |||
@Override | |||
public void setKnownContentConsumers( List<String> knownContentConsumers, AuditInformation auditInformation ) | |||
throws RepositoryAdminException | |||
{ | |||
} | |||
@Override | |||
public List<String> getKnownContentConsumers() | |||
throws RepositoryAdminException | |||
{ | |||
return null; | |||
} | |||
@Override | |||
public void removeKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation ) | |||
throws RepositoryAdminException | |||
{ | |||
} | |||
@Override | |||
public void addInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation ) | |||
throws RepositoryAdminException | |||
{ | |||
} | |||
@Override | |||
public void setInvalidContentConsumers( List<String> invalidContentConsumers, AuditInformation auditInformation ) | |||
throws RepositoryAdminException | |||
{ | |||
} | |||
@Override | |||
public List<String> getInvalidContentConsumers() | |||
throws RepositoryAdminException | |||
{ | |||
return null; | |||
} | |||
@Override | |||
public void removeInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation ) | |||
throws RepositoryAdminException | |||
{ | |||
} | |||
@Override | |||
public OrganisationInformation getOrganisationInformation() | |||
throws RepositoryAdminException | |||
{ | |||
return null; | |||
} | |||
@Override | |||
public void setOrganisationInformation( OrganisationInformation organisationInformation ) | |||
throws RepositoryAdminException | |||
{ | |||
} | |||
@Override | |||
public UiConfiguration getUiConfiguration() | |||
throws RepositoryAdminException | |||
{ | |||
return null; | |||
} | |||
@Override | |||
public void updateUiConfiguration( UiConfiguration uiConfiguration ) | |||
throws RepositoryAdminException | |||
{ | |||
} | |||
@Override | |||
public NetworkConfiguration getNetworkConfiguration() | |||
throws RepositoryAdminException | |||
{ | |||
return null; | |||
} | |||
@Override | |||
public void setNetworkConfiguration( NetworkConfiguration networkConfiguration ) | |||
throws RepositoryAdminException | |||
{ | |||
} | |||
} |
@@ -1,38 +0,0 @@ | |||
<?xml version="1.0"?> | |||
<!-- | |||
~ 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. | |||
--> | |||
<beans xmlns="http://www.springframework.org/schema/beans" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://www.springframework.org/schema/beans | |||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> | |||
<bean name="artifactConverter#force-repository-converter" class="org.apache.archiva.converter.artifact.LegacyToDefaultConverter"> | |||
<property name="force" value="true"/> | |||
<property name="dryrun" value="false"/> | |||
</bean> | |||
<bean name="artifactConverter#dryrun-repository-converter" class="org.apache.archiva.converter.artifact.LegacyToDefaultConverter"> | |||
<property name="force" value="false"/> | |||
<property name="dryrun" value="true"/> | |||
</bean> | |||
<bean name="mockArchivaAdministration" class="org.apache.archiva.converter.mock.MockArchivaAdministration"/> | |||
</beans> |
@@ -1 +0,0 @@ | |||
incorrectMd5 |
@@ -1,25 +0,0 @@ | |||
<!-- | |||
~ 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. | |||
--> | |||
<project> | |||
<pomVersion>3</pomVersion> | |||
<artifactId>incorrectArtifactMetadata</artifactId> | |||
<groupId>test</groupId> | |||
<currentVersion>1.0.0</currentVersion> | |||
</project> |
@@ -1,29 +0,0 @@ | |||
<?xml version="1.0" encoding="ISO-8859-1"?> | |||
<!-- | |||
~ 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. | |||
--> | |||
<metadata> | |||
<groupId>test</groupId> | |||
<artifactId>incorrectArtifactMetadata</artifactId> | |||
<versioning> | |||
<versions> | |||
<version>0.9</version> | |||
</versions> | |||
</versioning> | |||
</metadata> |
@@ -1 +0,0 @@ | |||
incorrectMd5 |
@@ -1,25 +0,0 @@ | |||
<!-- | |||
~ 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. | |||
--> | |||
<project> | |||
<pomVersion>3</pomVersion> | |||
<artifactId>incorrectSnapshotMetadata</artifactId> | |||
<groupId>test</groupId> | |||
<currentVersion>1.0.0-20060102.030405-6</currentVersion> | |||
</project> |
@@ -1,31 +0,0 @@ | |||
<?xml version="1.0" encoding="ISO-8859-1"?> | |||
<!-- | |||
~ 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. | |||
--> | |||
<metadata> | |||
<groupId>test</groupId> | |||
<artifactId>incorrectSnapshotMetadata</artifactId> | |||
<version>1.0.0-SNAPSHOT</version> | |||
<versioning> | |||
<snapshot> | |||
<buildNumber>10</buildNumber> | |||
<timestamp>20060102.040506</timestamp> | |||
</snapshot> | |||
</versioning> | |||
</metadata> |
@@ -1,29 +0,0 @@ | |||
<?xml version="1.0" encoding="ISO-8859-1"?> | |||
<!-- | |||
~ 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. | |||
--> | |||
<metadata> | |||
<groupId>test</groupId> | |||
<artifactId>incorrectSnapshotMetadata</artifactId> | |||
<versioning> | |||
<versions> | |||
<version>1.0.0-SNAPSHOT</version> | |||
</versions> | |||
</versioning> | |||
</metadata> |
@@ -1 +0,0 @@ | |||
one |
@@ -1 +0,0 @@ | |||
three |
@@ -1 +0,0 @@ | |||
two |
@@ -1 +0,0 @@ | |||
existing |
@@ -1 +0,0 @@ | |||
existing |
@@ -1 +0,0 @@ | |||
incorrectMd5 |
@@ -1 +0,0 @@ | |||
379dcfcd1e6312cc859111f696047eb4 |
@@ -1 +0,0 @@ | |||
incorrectSha1 |
@@ -1 +0,0 @@ | |||
52e07b82d944741f66bba5896d4cd74e9879e289 |
@@ -1 +0,0 @@ | |||
modified |
@@ -1 +0,0 @@ | |||
v4 |
@@ -1 +0,0 @@ | |||
noPom |
@@ -1 +0,0 @@ | |||
v3 |
@@ -1 +0,0 @@ | |||
v3 |
@@ -1 +0,0 @@ | |||
unmodified |
@@ -1 +0,0 @@ | |||
v3 |
@@ -1 +0,0 @@ | |||
v3 |
@@ -1 +0,0 @@ | |||
v3 |
@@ -1 +0,0 @@ | |||
v3 |
@@ -1 +0,0 @@ | |||
v3 |
@@ -1 +0,0 @@ | |||
v3 |
@@ -1 +0,0 @@ | |||
v4 |
@@ -1 +0,0 @@ | |||
4289bbdd6fba75013b317b2f9a540736 *v4artifact-1.0.0.jar |
@@ -1 +0,0 @@ | |||
e3e4159da65a4257f0bffb7cac8e3e78241a4dca *v4artifact-1.0.0.jar |
@@ -1 +0,0 @@ | |||
one |
@@ -1,6 +0,0 @@ | |||
<project> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>test</groupId> | |||
<artifactId>artifact-one</artifactId> | |||
<version>1.0.0</version> | |||
</project> |
@@ -1,6 +0,0 @@ | |||
<project> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>test</groupId> | |||
<artifactId>artifact-three</artifactId> | |||
<version>1.0.0</version> | |||
</project> |
@@ -1,6 +0,0 @@ | |||
<project> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>test</groupId> | |||
<artifactId>artifact-two</artifactId> | |||
<version>1.0.0</version> | |||
</project> |
@@ -1,22 +0,0 @@ | |||
<!-- | |||
~ Copyright 2005-2006 The Apache Software Foundation. | |||
~ | |||
~ Licensed 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. | |||
--> | |||
<project> | |||
<modelVersion>4.0.0</modelVersion> | |||
<artifactId>dryrun-artifact</artifactId> | |||
<groupId>test</groupId> | |||
<currentVersion>1.0.0</currentVersion> | |||
</project> |
@@ -1,6 +0,0 @@ | |||
<project> | |||
<pomVersion>3</pomVersion> | |||
<artifactId>incorrectMd5Artifact</artifactId> | |||
<groupId>test</groupId> | |||
<currentVersion>1.0.0</currentVersion> | |||
</project> |
@@ -1,6 +0,0 @@ | |||
<project> | |||
<pomVersion>3</pomVersion> | |||
<artifactId>incorrectSha1Artifact</artifactId> | |||
<groupId>test</groupId> | |||
<currentVersion>1.0.0</currentVersion> | |||
</project> |
@@ -1,6 +0,0 @@ | |||
<project> | |||
<pomVersion>3</pomVersion> | |||
<artifactId>maven-foo-plugin</artifactId> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<currentVersion>1.0</currentVersion> | |||
</project> |
@@ -1,22 +0,0 @@ | |||
<!-- | |||
~ Copyright 2005-2006 The Apache Software Foundation. | |||
~ | |||
~ Licensed 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. | |||
--> | |||
<project> | |||
<modelVersion>4.0.0</modelVersion> | |||
<artifactId>modified-artifact</artifactId> | |||
<groupId>test</groupId> | |||
<currentVersion>1.0.0</currentVersion> | |||
</project> |
@@ -1,22 +0,0 @@ | |||
<!-- | |||
~ Copyright 2005-2006 The Apache Software Foundation. | |||
~ | |||
~ Licensed 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. | |||
--> | |||
<project> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>test</groupId> | |||
<artifactId>newversoin-artifact</artifactId> | |||
<version>1.0.1</version> | |||
</project> |
@@ -1,27 +0,0 @@ | |||
<project> | |||
<pomVersion>3</pomVersion> | |||
<artifactId>relocated-v3artifact</artifactId> | |||
<groupId>test</groupId> | |||
<currentVersion>1.0.0</currentVersion> | |||
<dependencies> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>artifactId</artifactId> | |||
<version>version</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>test-artifactId</artifactId> | |||
<version>version</version> | |||
<properties> | |||
<scope>test</scope> | |||
</properties> | |||
</dependency> | |||
</dependencies> | |||
<repository> | |||
<connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection> | |||
</repository> | |||
<properties> | |||
<relocated.groupId>relocated-test</relocated.groupId> | |||
</properties> | |||
</project> |
@@ -1,39 +0,0 @@ | |||
<!-- | |||
~ Copyright 2005-2006 The Apache Software Foundation. | |||
~ | |||
~ Licensed 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. | |||
--> | |||
<project> | |||
<pomVersion>3</pomVersion> | |||
<artifactId>v3artifact</artifactId> | |||
<groupId>test</groupId> | |||
<currentVersion>1.0.0</currentVersion> | |||
<dependencies> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>artifactId</artifactId> | |||
<version>version</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>test-artifactId</artifactId> | |||
<version>version</version> | |||
<properties> | |||
<scope>test</scope> | |||
</properties> | |||
</dependency> | |||
</dependencies> | |||
<!-- deliberate parse error --> | |||
<repository> | |||
</project> |
@@ -1,25 +0,0 @@ | |||
<!-- | |||
~ 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. | |||
--> | |||
<project> | |||
<modelVersion>4.0.0</modelVersion> | |||
<artifactId>unmodified-artifact</artifactId> | |||
<groupId>test</groupId> | |||
<currentVersion>1.0.0</currentVersion> | |||
</project> |
@@ -1,48 +0,0 @@ | |||
<!-- | |||
~ Copyright 2005-2006 The Apache Software Foundation. | |||
~ | |||
~ Licensed 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. | |||
--> | |||
<project> | |||
<pomVersion>3</pomVersion> | |||
<extend>../project.xml</extend> | |||
<artifactId>v3-warnings-artifact</artifactId> | |||
<groupId>test</groupId> | |||
<currentVersion>1.0.0</currentVersion> | |||
<versions> | |||
<version> | |||
<id>1.0</id> | |||
<name>1.0</name> | |||
<tag>1_0</tag> | |||
</version> | |||
</versions> | |||
<dependencies> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>artifactId</artifactId> | |||
<version>version</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>test-artifactId</artifactId> | |||
<version>version</version> | |||
<properties> | |||
<scope>test</scope> | |||
</properties> | |||
</dependency> | |||
</dependencies> | |||
<repository> | |||
<connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection> | |||
</repository> | |||
</project> |
@@ -1,40 +0,0 @@ | |||
<!-- | |||
~ Copyright 2005-2006 The Apache Software Foundation. | |||
~ | |||
~ Licensed 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. | |||
--> | |||
<project> | |||
<pomVersion>3</pomVersion> | |||
<artifactId>v3artifact</artifactId> | |||
<groupId>test</groupId> | |||
<currentVersion>1.0.0-20060105.130101-3</currentVersion> | |||
<dependencies> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>artifactId</artifactId> | |||
<version>version</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>test-artifactId</artifactId> | |||
<version>version</version> | |||
<properties> | |||
<scope>test</scope> | |||
</properties> | |||
</dependency> | |||
</dependencies> | |||
<repository> | |||
<connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection> | |||
</repository> | |||
</project> |
@@ -1,40 +0,0 @@ | |||
<!-- | |||
~ Copyright 2005-2006 The Apache Software Foundation. | |||
~ | |||
~ Licensed 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. | |||
--> | |||
<project> | |||
<pomVersion>3</pomVersion> | |||
<artifactId>v3artifact</artifactId> | |||
<groupId>test</groupId> | |||
<currentVersion>1.0.0-SNAPSHOT</currentVersion> | |||
<dependencies> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>artifactId</artifactId> | |||
<version>version</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>test-artifactId</artifactId> | |||
<version>version</version> | |||
<properties> | |||
<scope>test</scope> | |||
</properties> | |||
</dependency> | |||
</dependencies> | |||
<repository> | |||
<connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection> | |||
</repository> | |||
</project> |
@@ -1,24 +0,0 @@ | |||
<project> | |||
<pomVersion>3</pomVersion> | |||
<artifactId>v3artifact</artifactId> | |||
<groupId>test</groupId> | |||
<currentVersion>1.0.0</currentVersion> | |||
<dependencies> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>artifactId</artifactId> | |||
<version>version</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>groupId</groupId> | |||
<artifactId>test-artifactId</artifactId> | |||
<version>version</version> | |||
<properties> | |||
<scope>test</scope> | |||
</properties> | |||
</dependency> | |||
</dependencies> | |||
<repository> | |||
<connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection> | |||
</repository> | |||
</project> |
@@ -1,22 +0,0 @@ | |||
<!-- | |||
~ Copyright 2005-2006 The Apache Software Foundation. | |||
~ | |||
~ Licensed 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. | |||
--> | |||
<project> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>test</groupId> | |||
<artifactId>v4artifact</artifactId> | |||
<version>1.0.0-20060111.120115-1</version> | |||
</project> |
@@ -1,22 +0,0 @@ | |||
<!-- | |||
~ Copyright 2005-2006 The Apache Software Foundation. | |||
~ | |||
~ Licensed 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. | |||
--> | |||
<project> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>test</groupId> | |||
<artifactId>v4artifact</artifactId> | |||
<version>1.0.0-SNAPSHOT</version> | |||
</project> |
@@ -1,6 +0,0 @@ | |||
<project> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>test</groupId> | |||
<artifactId>v4artifact</artifactId> | |||
<version>1.0.0</version> | |||
</project> |
@@ -1 +0,0 @@ | |||
unmodified |
@@ -1,25 +0,0 @@ | |||
<!-- | |||
~ 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. | |||
--> | |||
<project> | |||
<modelVersion>4.0.0</modelVersion> | |||
<artifactId>modified-artifact</artifactId> | |||
<groupId>test</groupId> | |||
<currentVersion>1.0.0</currentVersion> | |||
</project> |
@@ -1 +0,0 @@ | |||
unmodified |
@@ -1,25 +0,0 @@ | |||
<!-- | |||
~ 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. | |||
--> | |||
<project> | |||
<modelVersion>4.0.0</modelVersion> | |||
<artifactId>newversion-artifact</artifactId> | |||
<groupId>test</groupId> | |||
<currentVersion>1.0.0</currentVersion> | |||
</project> |
@@ -1,29 +0,0 @@ | |||
<?xml version="1.0" encoding="ISO-8859-1"?> | |||
<!-- | |||
~ 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. | |||
--> | |||
<metadata> | |||
<groupId>test</groupId> | |||
<artifactId>newversion-artifact</artifactId> | |||
<versioning> | |||
<versions> | |||
<version>1.0.0</version> | |||
</versions> | |||
</versioning> | |||
</metadata> |
@@ -1 +0,0 @@ | |||
unmodified |