mirror of https://github.com/apache/archiva.git
remove merged branch
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches@705164 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8430a3b449
commit
1a34621314
|
@ -1,74 +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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.maven.archiva</groupId>
|
||||
<artifactId>archiva-base</artifactId>
|
||||
<version>1.0-beta-4-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>archiva-artifact-converter</artifactId>
|
||||
<name>Archiva Artifact Converter</name>
|
||||
<description>Converts between Legacy and Modern Layout Artifacts.</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-repository-metadata</artifactId>
|
||||
<version>2.0.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact-manager</artifactId>
|
||||
<version>2.0.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.archiva</groupId>
|
||||
<artifactId>archiva-transaction</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-model-converter</artifactId>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>descriptor</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -1,50 +0,0 @@
|
|||
package org.apache.maven.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
|
||||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
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,58 +0,0 @@
|
|||
package org.apache.maven.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.Map;
|
||||
|
||||
/**
|
||||
* ArtifactConverter
|
||||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public interface ArtifactConverter
|
||||
{
|
||||
public static final String ROLE = ArtifactConverter.class.getName();
|
||||
|
||||
/**
|
||||
* 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 getWarnings();
|
||||
|
||||
/**
|
||||
* Clear the list of warning messages.
|
||||
*/
|
||||
void clearWarnings();
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
package org.apache.maven.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.codehaus.plexus.util.IOUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* AsciiFileUtil - conveinence utility for reading / writing ascii files.
|
||||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
* @todo switch to commons-lang and use their high-performance versions of these utility methods.
|
||||
*/
|
||||
public class AsciiFileUtil
|
||||
{
|
||||
/**
|
||||
* Read a file into a {@link String} and return it.
|
||||
*
|
||||
* @param file the file to read
|
||||
* @return the {@link String} contents of the file.
|
||||
* @throws IOException if there was a problem performing this operation.
|
||||
*/
|
||||
public static String readFile( File file )
|
||||
throws IOException
|
||||
{
|
||||
FileInputStream in = null;
|
||||
try
|
||||
{
|
||||
in = new FileInputStream( file );
|
||||
return IOUtil.toString( in );
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close( in );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the contents of a {@link String} to a file.
|
||||
*
|
||||
* @param file the file to write to
|
||||
* @param content the {@link String} contents to write.
|
||||
* @throws IOException if there was a problem performing this operation.
|
||||
*/
|
||||
public static void writeFile( File file, String content )
|
||||
throws IOException
|
||||
{
|
||||
FileOutputStream out = null;
|
||||
try
|
||||
{
|
||||
out = new FileOutputStream( file );
|
||||
IOUtil.copy( content, out );
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close( out );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,690 +0,0 @@
|
|||
package org.apache.maven.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.archiva.transaction.FileTransaction;
|
||||
import org.apache.maven.archiva.transaction.TransactionException;
|
||||
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.SnapshotArtifactRepositoryMetadata;
|
||||
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.digest.Digester;
|
||||
import org.codehaus.plexus.digest.DigesterException;
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
import org.codehaus.plexus.util.IOUtil;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
/**
|
||||
* LegacyToDefaultConverter
|
||||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.archiva.converter.artifact.ArtifactConverter"
|
||||
* role-hint="legacy-to-default"
|
||||
*/
|
||||
public class LegacyToDefaultConverter
|
||||
implements ArtifactConverter
|
||||
{
|
||||
/**
|
||||
* {@link List}<{@link Digester}>
|
||||
*
|
||||
* @plexus.requirement role="org.codehaus.plexus.digest.Digester"
|
||||
*/
|
||||
private List digesters;
|
||||
|
||||
/**
|
||||
* @plexus.requirement
|
||||
*/
|
||||
private ModelConverter translator;
|
||||
|
||||
/**
|
||||
* @plexus.requirement
|
||||
*/
|
||||
private ArtifactFactory artifactFactory;
|
||||
|
||||
/**
|
||||
* @plexus.requirement
|
||||
*/
|
||||
private ArtifactHandlerManager artifactHandlerManager;
|
||||
|
||||
/**
|
||||
* @plexus.configuration default-value="false"
|
||||
*/
|
||||
private boolean force;
|
||||
|
||||
/**
|
||||
* @plexus.configuration default-value="false"
|
||||
*/
|
||||
private boolean dryrun;
|
||||
|
||||
private Map warnings = new HashMap();
|
||||
|
||||
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.valueOf( matcher.group( 3 ) ).intValue() );
|
||||
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$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
File file = new File( repository.getBasedir(), repository.pathOf( pom ) );
|
||||
|
||||
boolean result = true;
|
||||
if ( file.exists() )
|
||||
{
|
||||
File targetFile = new File( 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 = AsciiFileUtil.readFile( file );
|
||||
}
|
||||
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
|
||||
try
|
||||
{
|
||||
boolean matching = false;
|
||||
if ( !force && targetFile.exists() )
|
||||
{
|
||||
String targetContents = AsciiFileUtil.readFile( targetFile );
|
||||
matching = targetContents.equals( contents );
|
||||
}
|
||||
if ( force || !matching )
|
||||
{
|
||||
transaction.createFile( contents, targetFile, digesters );
|
||||
}
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new ArtifactConversionException( Messages
|
||||
.getString( "unable.to.write.target.pom", e.getMessage() ), e ); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// v3 POM
|
||||
StringReader stringReader = new StringReader( contents );
|
||||
StringWriter writer = null;
|
||||
try
|
||||
{
|
||||
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 = new File( targetRepository.getBasedir(), targetRepository.pathOf( relocatedPom ) );
|
||||
}
|
||||
|
||||
Model v4Model = translator.translate( v3Model );
|
||||
|
||||
translator.validateV4Basics( v4Model, v3Model.getGroupId(), v3Model.getArtifactId(), v3Model
|
||||
.getVersion(), v3Model.getPackage() );
|
||||
|
||||
writer = new StringWriter();
|
||||
MavenXpp3Writer Xpp3Writer = new MavenXpp3Writer();
|
||||
Xpp3Writer.write( writer, v4Model );
|
||||
|
||||
transaction.createFile( writer.toString(), targetFile, digesters );
|
||||
|
||||
List warnings = translator.getWarnings();
|
||||
|
||||
for ( Iterator i = warnings.iterator(); i.hasNext(); )
|
||||
{
|
||||
String message = (String) i.next();
|
||||
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;
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close( writer );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addWarning( artifact, Messages.getString( "warning.missing.pom" ) ); //$NON-NLS-1$
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean testChecksums( Artifact artifact, File file )
|
||||
throws IOException
|
||||
{
|
||||
boolean result = true;
|
||||
Iterator it = digesters.iterator();
|
||||
while ( it.hasNext() )
|
||||
{
|
||||
Digester digester = (Digester) it.next();
|
||||
result &= verifyChecksum( file, file.getName() + "." + getDigesterFileExtension( digester ), digester, //$NON-NLS-1$
|
||||
artifact, "failure.incorrect." + getDigesterFileExtension( digester ) ); //$NON-NLS-1$
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean verifyChecksum( File file, String fileName, Digester digester, Artifact artifact, String key )
|
||||
throws IOException
|
||||
{
|
||||
boolean result = true;
|
||||
|
||||
File checksumFile = new File( file.getParentFile(), fileName );
|
||||
if ( checksumFile.exists() )
|
||||
{
|
||||
String checksum = AsciiFileUtil.readFile( checksumFile );
|
||||
try
|
||||
{
|
||||
digester.verify( file, checksum );
|
||||
}
|
||||
catch ( DigesterException e )
|
||||
{
|
||||
addWarning( artifact, Messages.getString( key ) );
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* File extension for checksums
|
||||
* TODO should be moved to plexus-digester ?
|
||||
*/
|
||||
private String getDigesterFileExtension( Digester digester )
|
||||
{
|
||||
return digester.getAlgorithm().toLowerCase().replaceAll( "-", "" ); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
private boolean copyArtifact( Artifact artifact, ArtifactRepository targetRepository, FileTransaction transaction )
|
||||
throws ArtifactConversionException
|
||||
{
|
||||
File sourceFile = artifact.getFile();
|
||||
|
||||
if ( sourceFile.getAbsolutePath().indexOf( "/plugins/" ) > -1 ) //$NON-NLS-1$
|
||||
{
|
||||
artifact.setArtifactHandler( artifactHandlerManager.getArtifactHandler( "maven-plugin" ) ); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
|
||||
|
||||
boolean result = true;
|
||||
try
|
||||
{
|
||||
boolean matching = false;
|
||||
if ( !force && targetFile.exists() )
|
||||
{
|
||||
matching = FileUtils.contentEquals( sourceFile, targetFile );
|
||||
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( File file )
|
||||
throws ArtifactConversionException
|
||||
{
|
||||
Metadata metadata;
|
||||
MetadataXpp3Reader reader = new MetadataXpp3Reader();
|
||||
FileReader fileReader = null;
|
||||
try
|
||||
{
|
||||
fileReader = new FileReader( file );
|
||||
metadata = reader.read( fileReader );
|
||||
}
|
||||
catch ( FileNotFoundException e )
|
||||
{
|
||||
throw new ArtifactConversionException( Messages.getString( "error.reading.target.metadata" ), e ); //$NON-NLS-1$
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new ArtifactConversionException( Messages.getString( "error.reading.target.metadata" ), e ); //$NON-NLS-1$
|
||||
}
|
||||
catch ( XmlPullParserException e )
|
||||
{
|
||||
throw new ArtifactConversionException( Messages.getString( "error.reading.target.metadata" ), e ); //$NON-NLS-1$
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close( fileReader );
|
||||
}
|
||||
return metadata;
|
||||
}
|
||||
|
||||
private boolean validateMetadata( Artifact artifact )
|
||||
throws ArtifactConversionException
|
||||
{
|
||||
ArtifactRepository repository = artifact.getRepository();
|
||||
|
||||
boolean result = true;
|
||||
|
||||
RepositoryMetadata repositoryMetadata = new ArtifactRepositoryMetadata( artifact );
|
||||
File file = new File( repository.getBasedir(), repository.pathOfRemoteRepositoryMetadata( repositoryMetadata ) );
|
||||
if ( file.exists() )
|
||||
{
|
||||
Metadata metadata = readMetadata( file );
|
||||
result = validateMetadata( metadata, repositoryMetadata, artifact );
|
||||
}
|
||||
|
||||
repositoryMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
|
||||
file = new File( repository.getBasedir(), repository.pathOfRemoteRepositoryMetadata( repositoryMetadata ) );
|
||||
if ( file.exists() )
|
||||
{
|
||||
Metadata metadata = readMetadata( file );
|
||||
result = result && validateMetadata( metadata, repositoryMetadata, artifact );
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
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 ( Iterator i = metadata.getVersioning().getVersions().iterator(); i.hasNext() && !foundVersion; )
|
||||
{
|
||||
String version = (String) i.next();
|
||||
if ( version.equals( artifact.getBaseVersion() ) )
|
||||
{
|
||||
foundVersion = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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.valueOf( matcher.group( 3 ) ).intValue();
|
||||
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
|
||||
{
|
||||
File file = new File( targetRepository.getBasedir(), targetRepository
|
||||
.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
|
||||
|
||||
Metadata metadata;
|
||||
boolean changed;
|
||||
|
||||
if ( file.exists() )
|
||||
{
|
||||
metadata = readMetadata( file );
|
||||
changed = metadata.merge( newMetadata );
|
||||
}
|
||||
else
|
||||
{
|
||||
changed = true;
|
||||
metadata = newMetadata;
|
||||
}
|
||||
|
||||
if ( changed )
|
||||
{
|
||||
StringWriter writer = null;
|
||||
try
|
||||
{
|
||||
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$
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close( writer );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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$
|
||||
File pomFile = new File( 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 messages = (List) warnings.get( artifact );
|
||||
if ( messages == null )
|
||||
{
|
||||
messages = new ArrayList();
|
||||
}
|
||||
messages.add( message );
|
||||
warnings.put( artifact, messages );
|
||||
}
|
||||
|
||||
public void clearWarnings()
|
||||
{
|
||||
warnings.clear();
|
||||
}
|
||||
|
||||
public Map getWarnings()
|
||||
{
|
||||
return warnings;
|
||||
}
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
package org.apache.maven.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
|
||||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class Messages
|
||||
{
|
||||
private static final String BUNDLE_NAME = "org.apache.maven.archiva.converter.artifact.messages"; //$NON-NLS-1$
|
||||
|
||||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||
|
||||
private Messages()
|
||||
{
|
||||
}
|
||||
|
||||
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,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,28 +0,0 @@
|
|||
<project>
|
||||
<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,28 +0,0 @@
|
|||
<project>
|
||||
<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,28 +0,0 @@
|
|||
<project>
|
||||
<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,28 +0,0 @@
|
|||
<project>
|
||||
<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,28 +0,0 @@
|
|||
<project>
|
||||
<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,12 +0,0 @@
|
|||
<project>
|
||||
<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>
|
File diff suppressed because it is too large
Load Diff
|
@ -1,85 +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.
|
||||
-->
|
||||
|
||||
<component-set>
|
||||
<components>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.archiva.converter.artifact.ArtifactConverter</role>
|
||||
<role-hint>force-repository-converter</role-hint>
|
||||
<implementation>org.apache.maven.archiva.converter.artifact.LegacyToDefaultConverter</implementation>
|
||||
<description>LegacyToDefaultConverter</description>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.codehaus.plexus.digest.Digester</role>
|
||||
<field-name>digesters</field-name>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.model.converter.ModelConverter</role>
|
||||
<field-name>translator</field-name>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
|
||||
<field-name>artifactFactory</field-name>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.handler.manager.ArtifactHandlerManager</role>
|
||||
<field-name>artifactHandlerManager</field-name>
|
||||
</requirement>
|
||||
</requirements>
|
||||
<configuration>
|
||||
<force>true</force>
|
||||
<dryrun>false</dryrun>
|
||||
</configuration>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.archiva.converter.artifact.ArtifactConverter</role>
|
||||
<role-hint>dryrun-repository-converter</role-hint>
|
||||
<implementation>org.apache.maven.archiva.converter.artifact.LegacyToDefaultConverter</implementation>
|
||||
<description>LegacyToDefaultConverter</description>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.codehaus.plexus.digest.Digester</role>
|
||||
<field-name>digesters</field-name>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.model.converter.ModelConverter</role>
|
||||
<field-name>translator</field-name>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
|
||||
<field-name>artifactFactory</field-name>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.handler.manager.ArtifactHandlerManager</role>
|
||||
<field-name>artifactHandlerManager</field-name>
|
||||
</requirement>
|
||||
</requirements>
|
||||
<configuration>
|
||||
<force>false</force>
|
||||
<dryrun>true</dryrun>
|
||||
</configuration>
|
||||
</component>
|
||||
|
||||
|
||||
|
||||
</components>
|
||||
</component-set>
|
|
@ -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
|
|
@ -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,62 +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.maven.archiva</groupId>
|
||||
<artifactId>archiva-base</artifactId>
|
||||
<version>1.0-beta-4-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>archiva-common</artifactId>
|
||||
<name>Archiva Base :: Common</name>
|
||||
<dependencies>
|
||||
<!-- TO OTHER DEVELOPERS:
|
||||
This module should depend on NO OTHER ARCHIVA MODULES.
|
||||
If you feel tempted to add one, discuss it first in the
|
||||
archiva-dev@maven.apache.org mailing-list.
|
||||
joakime@apache.org
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-digest</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-component-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -1,40 +0,0 @@
|
|||
package org.apache.maven.archiva.common;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* ArchivaException
|
||||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class ArchivaException
|
||||
extends Exception
|
||||
{
|
||||
public ArchivaException( String message, Throwable cause )
|
||||
{
|
||||
super( message, cause );
|
||||
}
|
||||
|
||||
public ArchivaException( String message )
|
||||
{
|
||||
super( message );
|
||||
}
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
package org.apache.maven.archiva.common.utils;
|
||||
|
||||
/*
|
||||
* 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.io.File;
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
* BaseFile - convenient File object that tracks the Base Directory and can provide relative path values
|
||||
* for the file object based on that Base Directory value.
|
||||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class BaseFile
|
||||
extends File
|
||||
{
|
||||
private File baseDir;
|
||||
|
||||
public BaseFile( File pathFile )
|
||||
{
|
||||
this( pathFile.getAbsolutePath() );
|
||||
}
|
||||
|
||||
public BaseFile( File repoDir, File pathFile )
|
||||
{
|
||||
this( repoDir, PathUtil.getRelative( repoDir.getAbsolutePath(), pathFile ) );
|
||||
}
|
||||
|
||||
public BaseFile( File parent, String child )
|
||||
{
|
||||
super( parent, child );
|
||||
this.baseDir = parent;
|
||||
}
|
||||
|
||||
public BaseFile( String pathname )
|
||||
{
|
||||
super( pathname );
|
||||
|
||||
// Calculate the top level directory.
|
||||
|
||||
File parent = this;
|
||||
while ( parent.getParentFile() != null )
|
||||
{
|
||||
parent = parent.getParentFile();
|
||||
}
|
||||
|
||||
this.baseDir = parent;
|
||||
}
|
||||
|
||||
public BaseFile( String repoDir, File pathFile )
|
||||
{
|
||||
this( new File( repoDir ), pathFile );
|
||||
}
|
||||
|
||||
public BaseFile( String parent, String child )
|
||||
{
|
||||
super( parent, child );
|
||||
this.baseDir = new File( parent );
|
||||
}
|
||||
|
||||
public BaseFile( URI uri )
|
||||
{
|
||||
super( uri ); // only to satisfy java compiler.
|
||||
throw new IllegalStateException( "The " + BaseFile.class.getName()
|
||||
+ " object does not support URI construction." );
|
||||
}
|
||||
|
||||
public File getBaseDir()
|
||||
{
|
||||
return baseDir;
|
||||
}
|
||||
|
||||
public String getRelativePath()
|
||||
{
|
||||
return PathUtil.getRelative( this.baseDir.getAbsolutePath(), this );
|
||||
}
|
||||
|
||||
public void setBaseDir( File baseDir )
|
||||
{
|
||||
this.baseDir = baseDir;
|
||||
}
|
||||
|
||||
public void setBaseDir( String repoDir )
|
||||
{
|
||||
setBaseDir( new File( repoDir ) );
|
||||
}
|
||||
}
|
|
@ -1,238 +0,0 @@
|
|||
package org.apache.maven.archiva.common.utils;
|
||||
|
||||
/*
|
||||
* 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.codehaus.plexus.digest.ChecksumFile;
|
||||
import org.codehaus.plexus.digest.Digester;
|
||||
import org.codehaus.plexus.digest.DigesterException;
|
||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Checksums utility component to validate or update checksums on Files.
|
||||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.archiva.common.utils.Checksums"
|
||||
*/
|
||||
public class Checksums
|
||||
extends AbstractLogEnabled
|
||||
{
|
||||
/**
|
||||
* @plexus.requirement role-hint="sha1"
|
||||
*/
|
||||
private Digester digestSha1;
|
||||
|
||||
/**
|
||||
* @plexus.requirement role-hint="md5"
|
||||
*/
|
||||
private Digester digestMd5;
|
||||
|
||||
/**
|
||||
* @plexus.requirement
|
||||
*/
|
||||
private ChecksumFile checksumFile;
|
||||
|
||||
public boolean check( File file )
|
||||
{
|
||||
boolean checksPass = true;
|
||||
|
||||
File sha1File = getSha1File( file );
|
||||
File md5File = getMd5File( file );
|
||||
|
||||
// Both files missing is a failure.
|
||||
if ( !sha1File.exists() && !md5File.exists() )
|
||||
{
|
||||
getLogger().error( "File " + file.getPath() + " has no checksum files (sha1 or md5)." );
|
||||
checksPass = false;
|
||||
}
|
||||
|
||||
if ( sha1File.exists() )
|
||||
{
|
||||
// Bad sha1 checksum is a failure.
|
||||
if ( !validateChecksum( sha1File, "sha1" ) )
|
||||
{
|
||||
getLogger().warn( "SHA1 is incorrect for " + file.getPath() );
|
||||
checksPass = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( md5File.exists() )
|
||||
{
|
||||
// Bad md5 checksum is a failure.
|
||||
if ( !validateChecksum( md5File, "md5" ) )
|
||||
{
|
||||
getLogger().warn( "MD5 is incorrect for " + file.getPath() );
|
||||
checksPass = false;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: eek!
|
||||
if ( !checksPass )
|
||||
{
|
||||
// On failure. delete files.
|
||||
if ( sha1File.exists() )
|
||||
{
|
||||
sha1File.delete();
|
||||
}
|
||||
|
||||
if ( md5File.exists() )
|
||||
{
|
||||
md5File.delete();
|
||||
}
|
||||
|
||||
file.delete();
|
||||
}
|
||||
|
||||
return checksPass;
|
||||
}
|
||||
|
||||
public boolean update( File file )
|
||||
{
|
||||
boolean checksPass = true;
|
||||
|
||||
File sha1File = getSha1File( file );
|
||||
File md5File = getMd5File( file );
|
||||
|
||||
if ( !fixChecksum( file, sha1File, digestSha1 ) )
|
||||
{
|
||||
checksPass = false;
|
||||
}
|
||||
|
||||
if ( !fixChecksum( file, md5File, digestMd5 ) )
|
||||
{
|
||||
checksPass = false;
|
||||
}
|
||||
|
||||
return checksPass;
|
||||
}
|
||||
|
||||
private boolean createChecksum( File localFile, Digester digester )
|
||||
{
|
||||
try
|
||||
{
|
||||
checksumFile.createChecksum( localFile, digester );
|
||||
return true;
|
||||
}
|
||||
catch ( DigesterException e )
|
||||
{
|
||||
getLogger().warn( "Unable to create " + digester.getFilenameExtension() + " file: " + e.getMessage(), e );
|
||||
return false;
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
getLogger().warn( "Unable to create " + digester.getFilenameExtension() + " file: " + e.getMessage(), e );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean fixChecksum( File localFile, File hashFile, Digester digester )
|
||||
{
|
||||
String ext = digester.getFilenameExtension();
|
||||
|
||||
if ( !hashFile.getPath().endsWith( ext ) )
|
||||
{
|
||||
throw new IllegalArgumentException( "Cannot fix " + hashFile.getPath() + " using " + ext + " digester." );
|
||||
}
|
||||
|
||||
// If hashfile doesn't exist, create it.
|
||||
if ( !hashFile.exists() )
|
||||
{
|
||||
return createChecksum( localFile, digester );
|
||||
}
|
||||
|
||||
// Validate checksum, if bad, recreate it.
|
||||
try
|
||||
{
|
||||
if ( checksumFile.isValidChecksum( hashFile ) )
|
||||
{
|
||||
getLogger().debug( "Valid checksum: " + hashFile.getPath() );
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
getLogger().debug( "Not valid checksum: " + hashFile.getPath() );
|
||||
return createChecksum( localFile, digester );
|
||||
}
|
||||
}
|
||||
catch ( FileNotFoundException e )
|
||||
{
|
||||
getLogger().warn( "Unable to find " + ext + " file: " + hashFile.getAbsolutePath(), e );
|
||||
return false;
|
||||
}
|
||||
catch ( DigesterException e )
|
||||
{
|
||||
getLogger().warn( "Unable to process " + ext + " file: " + hashFile.getAbsolutePath(), e );
|
||||
return false;
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
getLogger().warn( "Unable to process " + ext + " file: " + hashFile.getAbsolutePath(), e );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private File getMd5File( File file )
|
||||
{
|
||||
return new File( file.getAbsolutePath() + ".md5" );
|
||||
}
|
||||
|
||||
private File getSha1File( File file )
|
||||
{
|
||||
return new File( file.getAbsolutePath() + ".sha1" );
|
||||
|
||||
}
|
||||
|
||||
private boolean validateChecksum( File hashFile, String type )
|
||||
{
|
||||
try
|
||||
{
|
||||
boolean validity = checksumFile.isValidChecksum( hashFile );
|
||||
if ( validity )
|
||||
{
|
||||
getLogger().debug( "Valid checksum: " + hashFile.getPath() );
|
||||
}
|
||||
else
|
||||
{
|
||||
getLogger().debug( "Not valid checksum: " + hashFile.getPath() );
|
||||
}
|
||||
return validity;
|
||||
}
|
||||
catch ( FileNotFoundException e )
|
||||
{
|
||||
getLogger().warn( "Unable to find " + type + " file: " + hashFile.getAbsolutePath(), e );
|
||||
return false;
|
||||
}
|
||||
catch ( DigesterException e )
|
||||
{
|
||||
getLogger().warn( "Unable to process " + type + " file: " + hashFile.getAbsolutePath(), e );
|
||||
return false;
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
getLogger().warn( "Unable to process " + type + " file: " + hashFile.getAbsolutePath(), e );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
package org.apache.maven.archiva.common.utils;
|
||||
|
||||
/*
|
||||
* 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.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
/**
|
||||
* DateUtil - some (not-so) common date utility methods.
|
||||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class DateUtil
|
||||
{
|
||||
public static String getDuration( long duration )
|
||||
{
|
||||
return getDuration( new Date( 0 ), new Date( duration ) );
|
||||
}
|
||||
|
||||
public static String getDuration( long ms1, long ms2 )
|
||||
{
|
||||
return getDuration( new Date( ms1 ), new Date( ms2 ) );
|
||||
}
|
||||
|
||||
public static String getDuration( Date d1, Date d2 )
|
||||
{
|
||||
Calendar cal1 = new GregorianCalendar();
|
||||
cal1.setTime( d1 );
|
||||
|
||||
Calendar cal2 = new GregorianCalendar();
|
||||
cal2.setTime( d2 );
|
||||
|
||||
return getDuration( cal1, cal2 );
|
||||
}
|
||||
|
||||
public static String getDuration( Calendar cal1, Calendar cal2 )
|
||||
{
|
||||
int year1 = cal1.get( Calendar.YEAR );
|
||||
int day1 = cal1.get( Calendar.DAY_OF_YEAR );
|
||||
int hour1 = cal1.get( Calendar.HOUR_OF_DAY );
|
||||
int min1 = cal1.get( Calendar.MINUTE );
|
||||
int sec1 = cal1.get( Calendar.SECOND );
|
||||
int ms1 = cal1.get( Calendar.MILLISECOND );
|
||||
|
||||
int year2 = cal2.get( Calendar.YEAR );
|
||||
int day2 = cal2.get( Calendar.DAY_OF_YEAR );
|
||||
int hour2 = cal2.get( Calendar.HOUR_OF_DAY );
|
||||
int min2 = cal2.get( Calendar.MINUTE );
|
||||
int sec2 = cal2.get( Calendar.SECOND );
|
||||
int ms2 = cal2.get( Calendar.MILLISECOND );
|
||||
|
||||
int leftDays = ( day1 - day2 ) + ( year1 - year2 ) * 365;
|
||||
int leftHours = hour2 - hour1;
|
||||
int leftMins = min2 - min1;
|
||||
int leftSeconds = sec2 - sec1;
|
||||
int leftMilliSeconds = ms2 - ms1;
|
||||
|
||||
if ( leftMilliSeconds < 0 )
|
||||
{
|
||||
leftMilliSeconds += 1000;
|
||||
--leftSeconds;
|
||||
}
|
||||
|
||||
if ( leftSeconds < 0 )
|
||||
{
|
||||
leftSeconds += 60;
|
||||
--leftMins;
|
||||
}
|
||||
|
||||
if ( leftMins < 0 )
|
||||
{
|
||||
leftMins += 60;
|
||||
--leftHours;
|
||||
}
|
||||
|
||||
if ( leftHours < 0 )
|
||||
{
|
||||
leftHours += 24;
|
||||
--leftDays;
|
||||
}
|
||||
|
||||
StringBuffer interval = new StringBuffer();
|
||||
|
||||
appendInterval( interval, leftDays, "Day" );
|
||||
appendInterval( interval, leftHours, "Hour" );
|
||||
appendInterval( interval, leftMins, "Minute" );
|
||||
appendInterval( interval, leftSeconds, "Second" );
|
||||
appendInterval( interval, leftMilliSeconds, "Millisecond" );
|
||||
|
||||
return interval.toString();
|
||||
}
|
||||
|
||||
private static void appendInterval( StringBuffer interval, int count, String type )
|
||||
{
|
||||
if ( count > 0 )
|
||||
{
|
||||
if ( interval.length() > 0 )
|
||||
{
|
||||
interval.append( " " );
|
||||
}
|
||||
|
||||
interval.append( count );
|
||||
interval.append( " " ).append( type );
|
||||
if ( count > 1 )
|
||||
{
|
||||
interval.append( "s" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
package org.apache.maven.archiva.common.utils;
|
||||
|
||||
/*
|
||||
* 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.commons.lang.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
/**
|
||||
* PathUtil - simple utility methods for path manipulation.
|
||||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class PathUtil
|
||||
{
|
||||
public static String toUrl( String path )
|
||||
{
|
||||
// Is our work already done for us?
|
||||
if ( path.startsWith( "file:/" ) )
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
return toUrl( new File( path ) );
|
||||
}
|
||||
|
||||
public static String toUrl( File file )
|
||||
{
|
||||
try
|
||||
{
|
||||
return file.toURL().toExternalForm();
|
||||
}
|
||||
catch ( MalformedURLException e )
|
||||
{
|
||||
String pathCorrected = StringUtils.replaceChars( file.getAbsolutePath(), '\\', '/' );
|
||||
if ( pathCorrected.startsWith( "file:/" ) )
|
||||
{
|
||||
return pathCorrected;
|
||||
}
|
||||
|
||||
return "file://" + pathCorrected;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a basedir and a child file, return the relative path to the child.
|
||||
*
|
||||
* @param basedir the basedir.
|
||||
* @param file the file to get the relative path for.
|
||||
* @return the relative path to the child. (NOTE: this path will NOT start with a {@link File#separator} character)
|
||||
*/
|
||||
public static String getRelative( String basedir, File file )
|
||||
{
|
||||
return getRelative( basedir, file.getAbsolutePath() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a basedir and a child file, return the relative path to the child.
|
||||
*
|
||||
* @param basedir the basedir.
|
||||
* @param child the child path (can be a full path)
|
||||
* @return the relative path to the child. (NOTE: this path will NOT start with a {@link File#separator} character)
|
||||
*/
|
||||
public static String getRelative( String basedir, String child )
|
||||
{
|
||||
if ( basedir.endsWith( "/" ) || basedir.endsWith( "\\" ) )
|
||||
{
|
||||
basedir = basedir.substring( 0, basedir.length() - 1 );
|
||||
}
|
||||
|
||||
if ( child.startsWith( basedir ) )
|
||||
{
|
||||
// simple solution.
|
||||
return child.substring( basedir.length() + 1 );
|
||||
}
|
||||
|
||||
String absoluteBasedir = new File( basedir ).getAbsolutePath();
|
||||
if ( child.startsWith( absoluteBasedir ) )
|
||||
{
|
||||
// resolved basedir solution.
|
||||
return child.substring( absoluteBasedir.length() + 1 );
|
||||
}
|
||||
|
||||
// File is not within basedir.
|
||||
throw new IllegalStateException( "Unable to obtain relative path of file " + child
|
||||
+ ", it is not within basedir " + basedir + "." );
|
||||
}
|
||||
}
|
|
@ -1,260 +0,0 @@
|
|||
package org.apache.maven.archiva.common.utils;
|
||||
|
||||
/*
|
||||
* 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.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* VersionComparator - compare the parts of two version strings.
|
||||
* <p/>
|
||||
* Technique.
|
||||
* <p/>
|
||||
* * Split the version strings into parts by splitting on <code>"-._"</code> first, then breaking apart words from numbers.
|
||||
* <p/>
|
||||
* <code>
|
||||
* "1.0" = "1", "0"
|
||||
* "1.0-alpha-1" = "1", "0", "alpha", "1"
|
||||
* "2.0-rc2" = "2", "0", "rc", "2"
|
||||
* "1.3-m2" = "1", "3", "m", "3"
|
||||
* </code>
|
||||
* <p/>
|
||||
* compare each part individually, and when they do not match, perform the following test.
|
||||
* <p/>
|
||||
* Numbers are calculated per normal comparison rules.
|
||||
* Words that are part of the "special word list" will be treated as their index within that heirarchy.
|
||||
* Words that cannot be identified as special, are treated using normal case-insensitive comparison rules.
|
||||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class VersionComparator
|
||||
implements Comparator<String>
|
||||
{
|
||||
private static Comparator<String> INSTANCE = new VersionComparator();
|
||||
|
||||
private List<String> specialWords;
|
||||
|
||||
public VersionComparator()
|
||||
{
|
||||
specialWords = new ArrayList<String>();
|
||||
|
||||
// ids that refer to LATEST
|
||||
specialWords.add( "final" );
|
||||
specialWords.add( "release" );
|
||||
specialWords.add( "current" );
|
||||
specialWords.add( "latest" );
|
||||
specialWords.add( "g" );
|
||||
specialWords.add( "gold" );
|
||||
specialWords.add( "fcs" );
|
||||
|
||||
// ids that are for a release cycle.
|
||||
specialWords.add( "a" );
|
||||
specialWords.add( "alpha" );
|
||||
specialWords.add( "b" );
|
||||
specialWords.add( "beta" );
|
||||
specialWords.add( "pre" );
|
||||
specialWords.add( "rc" );
|
||||
specialWords.add( "m" );
|
||||
specialWords.add( "milestone" );
|
||||
|
||||
// ids that are for dev / debug cycles.
|
||||
specialWords.add( "dev" );
|
||||
specialWords.add( "test" );
|
||||
specialWords.add( "debug" );
|
||||
specialWords.add( "unofficial" );
|
||||
specialWords.add( "nightly" );
|
||||
specialWords.add( "incubating" );
|
||||
specialWords.add( "incubator" );
|
||||
specialWords.add( "snapshot" );
|
||||
}
|
||||
|
||||
public static Comparator<String> getInstance()
|
||||
{
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public int compare( String o1, String o2 )
|
||||
{
|
||||
if ( o1 == null && o2 == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( o1 == null )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( o2 == null )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
String[] parts1 = toParts( o1 );
|
||||
String[] parts2 = toParts( o2 );
|
||||
|
||||
int diff;
|
||||
int partLen = Math.max( parts1.length, parts2.length );
|
||||
for ( int i = 0; i < partLen; i++ )
|
||||
{
|
||||
diff = comparePart( safePart( parts1, i ), safePart( parts2, i ) );
|
||||
if ( diff != 0 )
|
||||
{
|
||||
return diff;
|
||||
}
|
||||
}
|
||||
|
||||
diff = parts2.length - parts1.length;
|
||||
|
||||
if ( diff != 0 )
|
||||
{
|
||||
return diff;
|
||||
}
|
||||
|
||||
return o1.compareToIgnoreCase( o2 );
|
||||
}
|
||||
|
||||
private String safePart( String[] parts, int idx )
|
||||
{
|
||||
if ( idx < parts.length )
|
||||
{
|
||||
return parts[idx];
|
||||
}
|
||||
|
||||
return "0";
|
||||
}
|
||||
|
||||
private int comparePart( String s1, String s2 )
|
||||
{
|
||||
boolean is1Num = NumberUtils.isNumber( s1 );
|
||||
boolean is2Num = NumberUtils.isNumber( s2 );
|
||||
|
||||
// (Special Case) Test for numbers both first.
|
||||
if ( is1Num && is2Num )
|
||||
{
|
||||
int i1 = NumberUtils.toInt( s1 );
|
||||
int i2 = NumberUtils.toInt( s2 );
|
||||
|
||||
return i1 - i2;
|
||||
}
|
||||
|
||||
// Test for text both next.
|
||||
if ( !is1Num && !is2Num )
|
||||
{
|
||||
int idx1 = specialWords.indexOf( s1.toLowerCase() );
|
||||
int idx2 = specialWords.indexOf( s2.toLowerCase() );
|
||||
|
||||
// Only operate perform index based operation, if both strings
|
||||
// are found in the specialWords index.
|
||||
if ( idx1 >= 0 && idx2 >= 0 )
|
||||
{
|
||||
return idx1 - idx2;
|
||||
}
|
||||
}
|
||||
|
||||
// Comparing text to num
|
||||
if ( !is1Num && is2Num )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Comparing num to text
|
||||
if ( is1Num && !is2Num )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Return comparison of strings themselves.
|
||||
return s1.compareToIgnoreCase( s2 );
|
||||
}
|
||||
|
||||
public static String[] toParts( String version )
|
||||
{
|
||||
if ( StringUtils.isBlank( version ) )
|
||||
{
|
||||
return ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
}
|
||||
|
||||
int modeOther = 0;
|
||||
int modeDigit = 1;
|
||||
int modeText = 2;
|
||||
|
||||
List<String> parts = new ArrayList<String>();
|
||||
int len = version.length();
|
||||
int i = 0;
|
||||
int start = 0;
|
||||
int mode = modeOther;
|
||||
|
||||
while ( i < len )
|
||||
{
|
||||
char c = version.charAt( i );
|
||||
|
||||
if ( Character.isDigit( c ) )
|
||||
{
|
||||
if ( mode != modeDigit )
|
||||
{
|
||||
if ( mode != modeOther )
|
||||
{
|
||||
parts.add( version.substring( start, i ) );
|
||||
}
|
||||
mode = modeDigit;
|
||||
start = i;
|
||||
}
|
||||
}
|
||||
else if ( Character.isLetter( c ) )
|
||||
{
|
||||
if ( mode != modeText )
|
||||
{
|
||||
if ( mode != modeOther )
|
||||
{
|
||||
parts.add( version.substring( start, i ) );
|
||||
}
|
||||
mode = modeText;
|
||||
start = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Other.
|
||||
if ( mode != modeOther )
|
||||
{
|
||||
parts.add( version.substring( start, i ) );
|
||||
mode = modeOther;
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
// Add remainder
|
||||
if ( mode != modeOther )
|
||||
{
|
||||
parts.add( version.substring( start, i ) );
|
||||
}
|
||||
|
||||
return parts.toArray( new String[parts.size()] );
|
||||
}
|
||||
}
|
|
@ -1,172 +0,0 @@
|
|||
package org.apache.maven.archiva.common.utils;
|
||||
|
||||
/*
|
||||
* 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.commons.lang.StringUtils;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Version utility methods.
|
||||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class VersionUtil
|
||||
{
|
||||
/**
|
||||
* These are the version patterns found in the filenames of the various artifact's versions IDs.
|
||||
* These patterns are all tackling lowercase version IDs.
|
||||
*/
|
||||
private static final String versionPatterns[] = new String[] {
|
||||
"([0-9][_.0-9a-z]*)",
|
||||
"(snapshot)",
|
||||
"(g?[_.0-9ab]*(pre|rc|g|m)[_.0-9]*)",
|
||||
"(dev[_.0-9]*)",
|
||||
"(alpha[_.0-9]*)",
|
||||
"(beta[_.0-9]*)",
|
||||
"(rc[_.0-9]*)",
|
||||
"(test[_.0-9]*)",
|
||||
"(debug[_.0-9]*)",
|
||||
"(unofficial[_.0-9]*)",
|
||||
"(current)",
|
||||
"(latest)",
|
||||
"(fcs)",
|
||||
"(release[_.0-9]*)",
|
||||
"(nightly)",
|
||||
"(final)",
|
||||
"(incubating)",
|
||||
"(incubator)",
|
||||
"([ab][_.0-9]+)" };
|
||||
|
||||
private static final String VersionMegaPattern = StringUtils.join( versionPatterns, '|' );
|
||||
|
||||
public static final String SNAPSHOT = "SNAPSHOT";
|
||||
|
||||
public static final Pattern UNIQUE_SNAPSHOT_PATTERN = Pattern.compile( "^(.*)-([0-9]{8}\\.[0-9]{6})-([0-9]+)$" );
|
||||
|
||||
public static final Pattern TIMESTAMP_PATTERN = Pattern.compile( "^([0-9]{8})\\.([0-9]{6})$" );
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Tests if the unknown string contains elements that identify it as a version string (or not).
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The algorithm tests each part of the string that is delimited by a '-' (dash) character.
|
||||
* If 75% or more of the sections are identified as 'version' strings, the result is
|
||||
* determined to be of a high probability to be version identifier string.
|
||||
* </p>
|
||||
*
|
||||
* @param unknown the unknown string to test.
|
||||
* @return true if the unknown string is likely a version string.
|
||||
*/
|
||||
public static boolean isVersion( String unknown )
|
||||
{
|
||||
String versionParts[] = StringUtils.split( unknown, '-' );
|
||||
|
||||
Pattern pat = Pattern.compile( VersionMegaPattern, Pattern.CASE_INSENSITIVE );
|
||||
Matcher mat;
|
||||
|
||||
int countValidParts = 0;
|
||||
|
||||
for ( int i = 0; i < versionParts.length; i++ )
|
||||
{
|
||||
String part = versionParts[i];
|
||||
mat = pat.matcher( part );
|
||||
|
||||
if ( mat.matches() )
|
||||
{
|
||||
countValidParts++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Calculate version probability as true if 3/4's of the input string has pieces of
|
||||
* of known version identifier strings.
|
||||
*/
|
||||
int threshold = (int) Math.floor( Math.max( (double) 1.0, (double) ( versionParts.length * 0.75 ) ) );
|
||||
|
||||
return ( countValidParts >= threshold );
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Tests if the identifier is a known simple version keyword.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* This method is different from {@link #isVersion(String)} in that it tests the whole input string in
|
||||
* one go as a simple identifier. (eg "alpha", "1.0", "beta", "debug", "latest", "rc#", etc...)
|
||||
* </p>
|
||||
*
|
||||
* @param identifier the identifier to test.
|
||||
* @return true if the unknown string is likely a version string.
|
||||
*/
|
||||
public static boolean isSimpleVersionKeyword( String identifier )
|
||||
{
|
||||
Pattern pat = Pattern.compile( VersionMegaPattern, Pattern.CASE_INSENSITIVE );
|
||||
Matcher mat = pat.matcher( identifier );
|
||||
|
||||
return mat.matches();
|
||||
}
|
||||
|
||||
public static boolean isSnapshot( String version )
|
||||
{
|
||||
Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version );
|
||||
if ( m.matches() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return version.endsWith( SNAPSHOT );
|
||||
}
|
||||
}
|
||||
|
||||
public static String getBaseVersion( String version )
|
||||
{
|
||||
Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version );
|
||||
if ( m.matches() )
|
||||
{
|
||||
return m.group( 1 ) + "-" + SNAPSHOT;
|
||||
}
|
||||
else
|
||||
{
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isUniqueSnapshot( String version )
|
||||
{
|
||||
Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version );
|
||||
if( m.matches() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isGenericSnapshot( String version )
|
||||
{
|
||||
return version.endsWith( SNAPSHOT );
|
||||
}
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
package org.apache.maven.archiva.common.utils;
|
||||
|
||||
/*
|
||||
* 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.commons.lang.StringUtils;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* BaseFileTest
|
||||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class BaseFileTest
|
||||
extends TestCase
|
||||
{
|
||||
public void testFileString()
|
||||
{
|
||||
File repoDir = new File( "/home/user/foo/repository" );
|
||||
String pathFile = "path/to/resource.xml";
|
||||
BaseFile file = new BaseFile( repoDir, pathFile );
|
||||
|
||||
assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
|
||||
assertRelativePath( "path/to/resource.xml", file );
|
||||
assertBasedir( "/home/user/foo/repository", file );
|
||||
}
|
||||
|
||||
public void testFileFile()
|
||||
{
|
||||
File repoDir = new File( "/home/user/foo/repository" );
|
||||
File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" );
|
||||
BaseFile file = new BaseFile( repoDir, pathFile );
|
||||
|
||||
assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
|
||||
assertRelativePath( "path/to/resource.xml", file );
|
||||
assertBasedir( "/home/user/foo/repository", file );
|
||||
}
|
||||
|
||||
public void testStringFile()
|
||||
{
|
||||
String repoDir = "/home/user/foo/repository";
|
||||
File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" );
|
||||
BaseFile file = new BaseFile( repoDir, pathFile );
|
||||
|
||||
assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
|
||||
assertRelativePath( "path/to/resource.xml", file );
|
||||
assertBasedir( "/home/user/foo/repository", file );
|
||||
}
|
||||
|
||||
public void testFileThenSetBaseString()
|
||||
{
|
||||
String repoDir = "/home/user/foo/repository";
|
||||
File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" );
|
||||
BaseFile file = new BaseFile( pathFile );
|
||||
file.setBaseDir( repoDir );
|
||||
|
||||
assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
|
||||
assertRelativePath( "path/to/resource.xml", file );
|
||||
assertBasedir( "/home/user/foo/repository", file );
|
||||
}
|
||||
|
||||
public void testFileThenSetBaseFile()
|
||||
{
|
||||
File repoDir = new File( "/home/user/foo/repository" );
|
||||
File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" );
|
||||
BaseFile file = new BaseFile( pathFile );
|
||||
file.setBaseDir( repoDir );
|
||||
|
||||
assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
|
||||
assertRelativePath( "path/to/resource.xml", file );
|
||||
assertBasedir( "/home/user/foo/repository", file );
|
||||
}
|
||||
|
||||
public void testStringThenSetBaseString()
|
||||
{
|
||||
String repoDir = "/home/user/foo/repository";
|
||||
String pathFile = "/home/user/foo/repository/path/to/resource.xml";
|
||||
BaseFile file = new BaseFile( pathFile );
|
||||
file.setBaseDir( repoDir );
|
||||
|
||||
assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
|
||||
assertRelativePath( "path/to/resource.xml", file );
|
||||
assertBasedir( "/home/user/foo/repository", file );
|
||||
}
|
||||
|
||||
public void testStringThenSetBaseFile()
|
||||
{
|
||||
File repoDir = new File( "/home/user/foo/repository" );
|
||||
String pathFile = "/home/user/foo/repository/path/to/resource.xml";
|
||||
BaseFile file = new BaseFile( pathFile );
|
||||
file.setBaseDir( repoDir );
|
||||
|
||||
assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
|
||||
assertRelativePath( "path/to/resource.xml", file );
|
||||
assertBasedir( "/home/user/foo/repository", file );
|
||||
}
|
||||
|
||||
private void assertAbsolutePath( String expectedPath, BaseFile actualFile )
|
||||
{
|
||||
assertEquals( new File( expectedPath ).getAbsolutePath(), actualFile.getAbsolutePath() );
|
||||
}
|
||||
|
||||
private void assertRelativePath( String expectedPath, BaseFile actualFile )
|
||||
{
|
||||
assertEquals( expectedPath, StringUtils.replace( actualFile.getRelativePath(), "\\", "/" ) );
|
||||
}
|
||||
|
||||
private void assertBasedir( String expectedPath, BaseFile actualFile )
|
||||
{
|
||||
assertEquals( new File( expectedPath ), actualFile.getBaseDir() );
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue