瀏覽代碼

Moving maven-artifact-converter to archiva trunk.



git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@542525 13f79535-47bb-0310-9956-ffa450edef68
tags/archiva-1.0-alpha-1
Joakim Erdfelt 17 年之前
父節點
當前提交
6622c0e72f
共有 91 個文件被更改,包括 3127 次插入0 次删除
  1. 78
    0
      archiva-base/maven-artifact-converter/pom.xml
  2. 50
    0
      archiva-base/maven-artifact-converter/src/main/java/org/apache/maven/artifact/converter/ArtifactConversionException.java
  3. 58
    0
      archiva-base/maven-artifact-converter/src/main/java/org/apache/maven/artifact/converter/ArtifactConverter.java
  4. 81
    0
      archiva-base/maven-artifact-converter/src/main/java/org/apache/maven/artifact/converter/AsciiFileUtil.java
  5. 690
    0
      archiva-base/maven-artifact-converter/src/main/java/org/apache/maven/artifact/converter/LegacyToDefaultConverter.java
  6. 71
    0
      archiva-base/maven-artifact-converter/src/main/java/org/apache/maven/artifact/converter/Messages.java
  7. 51
    0
      archiva-base/maven-artifact-converter/src/main/resources/org/apache/maven/artifact/converter/messages.properties
  8. 6
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/converted-artifact-one.pom
  9. 6
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/converted-artifact-three.pom
  10. 6
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/converted-artifact-two.pom
  11. 28
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/converted-v3-snapshot.pom
  12. 28
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/converted-v3-timestamped-snapshot.pom
  13. 28
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/converted-v3-warnings.pom
  14. 28
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/converted-v3.pom
  15. 7
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/maven-foo-plugin-1.0.pom
  16. 10
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/newversion-artifact-metadata.xml
  17. 6
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/maven-metadata.xml
  18. 1
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.jar
  19. 28
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.pom
  20. 9
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/maven-metadata.xml
  21. 12
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.pom
  22. 9
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/v3-artifact-metadata.xml
  23. 9
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/v3-snapshot-artifact-metadata.xml
  24. 6
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/v3-snapshot-metadata.xml
  25. 11
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/v3-timestamped-snapshot-metadata.xml
  26. 6
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/v3-version-metadata.xml
  27. 9
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/v4-artifact-metadata.xml
  28. 9
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/v4-snapshot-artifact-metadata.xml
  29. 6
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/v4-snapshot-metadata.xml
  30. 11
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/v4-timestamped-snapshot-metadata.xml
  31. 6
    0
      archiva-base/maven-artifact-converter/src/test/expected-files/v4-version-metadata.xml
  32. 1010
    0
      archiva-base/maven-artifact-converter/src/test/java/org/apache/maven/artifact/converter/LegacyToDefaultConverterTest.java
  33. 85
    0
      archiva-base/maven-artifact-converter/src/test/resources/org/apache/maven/artifact/converter/LegacyToDefaultConverterTest.xml
  34. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/1.0.0/incorrectArtifactMetadata-1.0.0.jar
  35. 25
    0
      archiva-base/maven-artifact-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/1.0.0/incorrectArtifactMetadata-1.0.0.pom
  36. 29
    0
      archiva-base/maven-artifact-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/maven-metadata.xml
  37. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/incorrectSnapshotMetadata-1.0.0-20060102.030405-6.jar
  38. 25
    0
      archiva-base/maven-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/incorrectSnapshotMetadata-1.0.0-20060102.030405-6.pom
  39. 31
    0
      archiva-base/maven-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/maven-metadata.xml
  40. 29
    0
      archiva-base/maven-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/maven-metadata.xml
  41. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/artifact-one-1.0.0.jar
  42. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/artifact-three-1.0.0.jar
  43. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/artifact-two-1.0.0.jar
  44. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/dryrun-artifact-1.0.0.jar
  45. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/existing-artifact-1.0.0.jar
  46. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar
  47. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar.md5
  48. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar
  49. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar.sha1
  50. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/modified-artifact-1.0.0.jar
  51. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/newversion-artifact-1.0.1.jar
  52. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/noPomArtifact-1.0.0.jar
  53. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/relocated-v3artifact-1.0.0.jar
  54. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/rollback-created-artifact-1.0.0.jar
  55. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/unmodified-artifact-1.0.0.jar
  56. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/v3-warnings-artifact-1.0.0.jar
  57. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/v3artifact-1.0.0-20060105.130101-3.jar
  58. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/v3artifact-1.0.0-SNAPSHOT.jar
  59. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/v3artifact-1.0.0.jar
  60. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0-20060111.120115-1.jar
  61. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0-SNAPSHOT.jar
  62. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar
  63. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar.md5
  64. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar.sha1
  65. 1
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/plugins/maven-foo-plugin-1.0.jar
  66. 6
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/artifact-one-1.0.0.pom
  67. 6
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/artifact-three-1.0.0.pom
  68. 6
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/artifact-two-1.0.0.pom
  69. 22
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/dryrun-artifact-1.0.0.pom
  70. 6
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/incorrectMd5Artifact-1.0.0.pom
  71. 6
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/incorrectSha1Artifact-1.0.0.pom
  72. 6
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/maven-foo-plugin-1.0.pom
  73. 22
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/modified-artifact-1.0.0.pom
  74. 22
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/newversion-artifact-1.0.1.pom
  75. 27
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/relocated-v3artifact-1.0.0.pom
  76. 39
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/rollback-created-artifact-1.0.0.pom
  77. 25
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/unmodified-artifact-1.0.0.pom
  78. 48
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/v3-warnings-artifact-1.0.0.pom
  79. 40
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-20060105.130101-3.pom
  80. 40
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-SNAPSHOT.pom
  81. 24
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/v3artifact-1.0.0.pom
  82. 22
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/v4artifact-1.0.0-20060111.120115-1.pom
  83. 22
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/v4artifact-1.0.0-SNAPSHOT.pom
  84. 6
    0
      archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/v4artifact-1.0.0.pom
  85. 1
    0
      archiva-base/maven-artifact-converter/src/test/target-repository/test/modified-artifact/1.0.0/modified-artifact-1.0.0.jar
  86. 25
    0
      archiva-base/maven-artifact-converter/src/test/target-repository/test/modified-artifact/1.0.0/modified-artifact-1.0.0.pom
  87. 1
    0
      archiva-base/maven-artifact-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.jar
  88. 25
    0
      archiva-base/maven-artifact-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.pom
  89. 29
    0
      archiva-base/maven-artifact-converter/src/test/target-repository/test/newversion-artifact/maven-metadata.xml
  90. 1
    0
      archiva-base/maven-artifact-converter/src/test/target-repository/test/unmodified-artifact/1.0.0/unmodified-artifact-1.0.0.jar
  91. 25
    0
      archiva-base/maven-artifact-converter/src/test/target-repository/test/unmodified-artifact/1.0.0/unmodified-artifact-1.0.0.pom

+ 78
- 0
archiva-base/maven-artifact-converter/pom.xml 查看文件

@@ -0,0 +1,78 @@
<?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.shared</groupId>
<artifactId>maven-shared-components</artifactId>
<version>6</version>
</parent>
<artifactId>maven-artifact-converter</artifactId>
<version>2.1-alpha-2-SNAPSHOT</version>
<name>Maven 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.shared</groupId>
<artifactId>maven-transaction</artifactId>
<version>1.0-alpha-1</version>
</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>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
<version>1.0-alpha-9</version>
</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>

+ 50
- 0
archiva-base/maven-artifact-converter/src/main/java/org/apache/maven/artifact/converter/ArtifactConversionException.java 查看文件

@@ -0,0 +1,50 @@
package org.apache.maven.artifact.converter;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
* ArtifactConversionException
*
* @author <a href="mailto:joakim@erdfelt.com">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 );
}
}

+ 58
- 0
archiva-base/maven-artifact-converter/src/main/java/org/apache/maven/artifact/converter/ArtifactConverter.java 查看文件

@@ -0,0 +1,58 @@
package org.apache.maven.artifact.converter;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;

import java.util.Map;

/**
* ArtifactConverter
*
* @author <a href="mailto:joakim@erdfelt.com">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}&lt;{@link Artifact}, {@link String}&gt; warning messages.
*/
Map getWarnings();

/**
* Clear the list of warning messages.
*/
void clearWarnings();
}

+ 81
- 0
archiva-base/maven-artifact-converter/src/main/java/org/apache/maven/artifact/converter/AsciiFileUtil.java 查看文件

@@ -0,0 +1,81 @@
package org.apache.maven.artifact.converter;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import 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:joakim@erdfelt.com">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 );
}
}
}

+ 690
- 0
archiva-base/maven-artifact-converter/src/main/java/org/apache/maven/artifact/converter/LegacyToDefaultConverter.java 查看文件

@@ -0,0 +1,690 @@
package org.apache.maven.artifact.converter;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import 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.apache.maven.transaction.FileTransaction;
import org.apache.maven.transaction.TransactionException;
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:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*
* @plexus.component role="org.apache.maven.artifact.converter.ArtifactConverter"
* role-hint="legacy-to-default"
*/
public class LegacyToDefaultConverter
implements ArtifactConverter
{
/**
* {@link List}&lt;{@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;
}
}

+ 71
- 0
archiva-base/maven-artifact-converter/src/main/java/org/apache/maven/artifact/converter/Messages.java 查看文件

@@ -0,0 +1,71 @@
package org.apache.maven.artifact.converter;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

/**
* Messages
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public class Messages
{
private static final String BUNDLE_NAME = "org.apache.maven.artifact.converter.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 + '!';
}
}
}

+ 51
- 0
archiva-base/maven-artifact-converter/src/main/resources/org/apache/maven/artifact/converter/messages.properties 查看文件

@@ -0,0 +1,51 @@
#
# 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.

+ 6
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/converted-artifact-one.pom 查看文件

@@ -0,0 +1,6 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>artifact-one</artifactId>
<version>1.0.0</version>
</project>

+ 6
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/converted-artifact-three.pom 查看文件

@@ -0,0 +1,6 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>artifact-three</artifactId>
<version>1.0.0</version>
</project>

+ 6
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/converted-artifact-two.pom 查看文件

@@ -0,0 +1,6 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>artifact-two</artifactId>
<version>1.0.0</version>
</project>

+ 28
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/converted-v3-snapshot.pom 查看文件

@@ -0,0 +1,28 @@
<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>

+ 28
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/converted-v3-timestamped-snapshot.pom 查看文件

@@ -0,0 +1,28 @@
<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>

+ 28
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/converted-v3-warnings.pom 查看文件

@@ -0,0 +1,28 @@
<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>

+ 28
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/converted-v3.pom 查看文件

@@ -0,0 +1,28 @@
<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>

+ 7
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/maven-foo-plugin-1.0.pom 查看文件

@@ -0,0 +1,7 @@
<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>

+ 10
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/newversion-artifact-metadata.xml 查看文件

@@ -0,0 +1,10 @@
<metadata>
<groupId>test</groupId>
<artifactId>newversion-artifact</artifactId>
<versioning>
<versions>
<version>1.0.0</version>
<version>1.0.1</version>
</versions>
</versioning>
</metadata>

+ 6
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/maven-metadata.xml 查看文件

@@ -0,0 +1,6 @@
<metadata>
<groupId>relocated-test</groupId>
<artifactId>relocated-v3artifact</artifactId>
<version>1.0.0</version>
<versioning />
</metadata>

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.jar 查看文件

@@ -0,0 +1 @@
v3

+ 28
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.pom 查看文件

@@ -0,0 +1,28 @@
<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>

+ 9
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/maven-metadata.xml 查看文件

@@ -0,0 +1,9 @@
<metadata>
<groupId>relocated-test</groupId>
<artifactId>relocated-v3artifact</artifactId>
<versioning>
<versions>
<version>1.0.0</version>
</versions>
</versioning>
</metadata>

+ 12
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.pom 查看文件

@@ -0,0 +1,12 @@
<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>

+ 9
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/v3-artifact-metadata.xml 查看文件

@@ -0,0 +1,9 @@
<metadata>
<groupId>test</groupId>
<artifactId>v3artifact</artifactId>
<versioning>
<versions>
<version>1.0.0</version>
</versions>
</versioning>
</metadata>

+ 9
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/v3-snapshot-artifact-metadata.xml 查看文件

@@ -0,0 +1,9 @@
<metadata>
<groupId>test</groupId>
<artifactId>v3artifact</artifactId>
<versioning>
<versions>
<version>1.0.0-SNAPSHOT</version>
</versions>
</versioning>
</metadata>

+ 6
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/v3-snapshot-metadata.xml 查看文件

@@ -0,0 +1,6 @@
<metadata>
<groupId>test</groupId>
<artifactId>v3artifact</artifactId>
<version>1.0.0-SNAPSHOT</version>
<versioning />
</metadata>

+ 11
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/v3-timestamped-snapshot-metadata.xml 查看文件

@@ -0,0 +1,11 @@
<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>

+ 6
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/v3-version-metadata.xml 查看文件

@@ -0,0 +1,6 @@
<metadata>
<groupId>test</groupId>
<artifactId>v3artifact</artifactId>
<version>1.0.0</version>
<versioning />
</metadata>

+ 9
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/v4-artifact-metadata.xml 查看文件

@@ -0,0 +1,9 @@
<metadata>
<groupId>test</groupId>
<artifactId>v4artifact</artifactId>
<versioning>
<versions>
<version>1.0.0</version>
</versions>
</versioning>
</metadata>

+ 9
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/v4-snapshot-artifact-metadata.xml 查看文件

@@ -0,0 +1,9 @@
<metadata>
<groupId>test</groupId>
<artifactId>v4artifact</artifactId>
<versioning>
<versions>
<version>1.0.0-SNAPSHOT</version>
</versions>
</versioning>
</metadata>

+ 6
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/v4-snapshot-metadata.xml 查看文件

@@ -0,0 +1,6 @@
<metadata>
<groupId>test</groupId>
<artifactId>v4artifact</artifactId>
<version>1.0.0-SNAPSHOT</version>
<versioning />
</metadata>

+ 11
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/v4-timestamped-snapshot-metadata.xml 查看文件

@@ -0,0 +1,11 @@
<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>

+ 6
- 0
archiva-base/maven-artifact-converter/src/test/expected-files/v4-version-metadata.xml 查看文件

@@ -0,0 +1,6 @@
<metadata>
<groupId>test</groupId>
<artifactId>v4artifact</artifactId>
<version>1.0.0</version>
<versioning />
</metadata>

+ 1010
- 0
archiva-base/maven-artifact-converter/src/test/java/org/apache/maven/artifact/converter/LegacyToDefaultConverterTest.java
文件差異過大導致無法顯示
查看文件


+ 85
- 0
archiva-base/maven-artifact-converter/src/test/resources/org/apache/maven/artifact/converter/LegacyToDefaultConverterTest.xml 查看文件

@@ -0,0 +1,85 @@
<?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.artifact.converter.ArtifactConverter</role>
<role-hint>force-repository-converter</role-hint>
<implementation>org.apache.maven.artifact.converter.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.artifact.converter.ArtifactConverter</role>
<role-hint>dryrun-repository-converter</role-hint>
<implementation>org.apache.maven.artifact.converter.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
archiva-base/maven-artifact-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/1.0.0/incorrectArtifactMetadata-1.0.0.jar 查看文件

@@ -0,0 +1 @@
incorrectMd5

+ 25
- 0
archiva-base/maven-artifact-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/1.0.0/incorrectArtifactMetadata-1.0.0.pom 查看文件

@@ -0,0 +1,25 @@
<!--
~ 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>

+ 29
- 0
archiva-base/maven-artifact-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/maven-metadata.xml 查看文件

@@ -0,0 +1,29 @@
<?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
archiva-base/maven-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/incorrectSnapshotMetadata-1.0.0-20060102.030405-6.jar 查看文件

@@ -0,0 +1 @@
incorrectMd5

+ 25
- 0
archiva-base/maven-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/incorrectSnapshotMetadata-1.0.0-20060102.030405-6.pom 查看文件

@@ -0,0 +1,25 @@
<!--
~ 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>

+ 31
- 0
archiva-base/maven-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/maven-metadata.xml 查看文件

@@ -0,0 +1,31 @@
<?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>

+ 29
- 0
archiva-base/maven-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/maven-metadata.xml 查看文件

@@ -0,0 +1,29 @@
<?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
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/artifact-one-1.0.0.jar 查看文件

@@ -0,0 +1 @@
one

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/artifact-three-1.0.0.jar 查看文件

@@ -0,0 +1 @@
three

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/artifact-two-1.0.0.jar 查看文件

@@ -0,0 +1 @@
two

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/dryrun-artifact-1.0.0.jar 查看文件

@@ -0,0 +1 @@
existing

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/existing-artifact-1.0.0.jar 查看文件

@@ -0,0 +1 @@
existing

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar 查看文件

@@ -0,0 +1 @@
incorrectMd5

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar.md5 查看文件

@@ -0,0 +1 @@
379dcfcd1e6312cc859111f696047eb4

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar 查看文件

@@ -0,0 +1 @@
incorrectSha1

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar.sha1 查看文件

@@ -0,0 +1 @@
52e07b82d944741f66bba5896d4cd74e9879e289

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/modified-artifact-1.0.0.jar 查看文件

@@ -0,0 +1 @@
modified

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/newversion-artifact-1.0.1.jar 查看文件

@@ -0,0 +1 @@
v4

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/noPomArtifact-1.0.0.jar 查看文件

@@ -0,0 +1 @@
noPom

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/relocated-v3artifact-1.0.0.jar 查看文件

@@ -0,0 +1 @@
v3

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/rollback-created-artifact-1.0.0.jar 查看文件

@@ -0,0 +1 @@
v3

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/unmodified-artifact-1.0.0.jar 查看文件

@@ -0,0 +1 @@
unmodified

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/v3-warnings-artifact-1.0.0.jar 查看文件

@@ -0,0 +1 @@
v3

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/v3artifact-1.0.0-20060105.130101-3.jar 查看文件

@@ -0,0 +1 @@
v3

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/v3artifact-1.0.0-SNAPSHOT.jar 查看文件

@@ -0,0 +1 @@
v3

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/v3artifact-1.0.0.jar 查看文件

@@ -0,0 +1 @@
v3

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0-20060111.120115-1.jar 查看文件

@@ -0,0 +1 @@
v3

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0-SNAPSHOT.jar 查看文件

@@ -0,0 +1 @@
v3

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar 查看文件

@@ -0,0 +1 @@
v4

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar.md5 查看文件

@@ -0,0 +1 @@
4289bbdd6fba75013b317b2f9a540736 *v4artifact-1.0.0.jar

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar.sha1 查看文件

@@ -0,0 +1 @@
e3e4159da65a4257f0bffb7cac8e3e78241a4dca *v4artifact-1.0.0.jar

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/plugins/maven-foo-plugin-1.0.jar 查看文件

@@ -0,0 +1 @@
one

+ 6
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/artifact-one-1.0.0.pom 查看文件

@@ -0,0 +1,6 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>artifact-one</artifactId>
<version>1.0.0</version>
</project>

+ 6
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/artifact-three-1.0.0.pom 查看文件

@@ -0,0 +1,6 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>artifact-three</artifactId>
<version>1.0.0</version>
</project>

+ 6
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/artifact-two-1.0.0.pom 查看文件

@@ -0,0 +1,6 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>artifact-two</artifactId>
<version>1.0.0</version>
</project>

+ 22
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/dryrun-artifact-1.0.0.pom 查看文件

@@ -0,0 +1,22 @@
<!--
~ 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>

+ 6
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/incorrectMd5Artifact-1.0.0.pom 查看文件

@@ -0,0 +1,6 @@
<project>
<pomVersion>3</pomVersion>
<artifactId>incorrectMd5Artifact</artifactId>
<groupId>test</groupId>
<currentVersion>1.0.0</currentVersion>
</project>

+ 6
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/incorrectSha1Artifact-1.0.0.pom 查看文件

@@ -0,0 +1,6 @@
<project>
<pomVersion>3</pomVersion>
<artifactId>incorrectSha1Artifact</artifactId>
<groupId>test</groupId>
<currentVersion>1.0.0</currentVersion>
</project>

+ 6
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/maven-foo-plugin-1.0.pom 查看文件

@@ -0,0 +1,6 @@
<project>
<pomVersion>3</pomVersion>
<artifactId>maven-foo-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<currentVersion>1.0</currentVersion>
</project>

+ 22
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/modified-artifact-1.0.0.pom 查看文件

@@ -0,0 +1,22 @@
<!--
~ 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>

+ 22
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/newversion-artifact-1.0.1.pom 查看文件

@@ -0,0 +1,22 @@
<!--
~ 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>

+ 27
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/relocated-v3artifact-1.0.0.pom 查看文件

@@ -0,0 +1,27 @@
<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>

+ 39
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/rollback-created-artifact-1.0.0.pom 查看文件

@@ -0,0 +1,39 @@
<!--
~ 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>

+ 25
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/unmodified-artifact-1.0.0.pom 查看文件

@@ -0,0 +1,25 @@
<!--
~ 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>

+ 48
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/v3-warnings-artifact-1.0.0.pom 查看文件

@@ -0,0 +1,48 @@
<!--
~ 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>

+ 40
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-20060105.130101-3.pom 查看文件

@@ -0,0 +1,40 @@
<!--
~ 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>

+ 40
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-SNAPSHOT.pom 查看文件

@@ -0,0 +1,40 @@
<!--
~ 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>

+ 24
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/v3artifact-1.0.0.pom 查看文件

@@ -0,0 +1,24 @@
<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>

+ 22
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/v4artifact-1.0.0-20060111.120115-1.pom 查看文件

@@ -0,0 +1,22 @@
<!--
~ 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>

+ 22
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/v4artifact-1.0.0-SNAPSHOT.pom 查看文件

@@ -0,0 +1,22 @@
<!--
~ 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>

+ 6
- 0
archiva-base/maven-artifact-converter/src/test/source-repository/test/poms/v4artifact-1.0.0.pom 查看文件

@@ -0,0 +1,6 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>v4artifact</artifactId>
<version>1.0.0</version>
</project>

+ 1
- 0
archiva-base/maven-artifact-converter/src/test/target-repository/test/modified-artifact/1.0.0/modified-artifact-1.0.0.jar 查看文件

@@ -0,0 +1 @@
unmodified

+ 25
- 0
archiva-base/maven-artifact-converter/src/test/target-repository/test/modified-artifact/1.0.0/modified-artifact-1.0.0.pom 查看文件

@@ -0,0 +1,25 @@
<!--
~ 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
archiva-base/maven-artifact-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.jar 查看文件

@@ -0,0 +1 @@
unmodified

+ 25
- 0
archiva-base/maven-artifact-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.pom 查看文件

@@ -0,0 +1,25 @@
<!--
~ 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>

+ 29
- 0
archiva-base/maven-artifact-converter/src/test/target-repository/test/newversion-artifact/maven-metadata.xml 查看文件

@@ -0,0 +1,29 @@
<?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
archiva-base/maven-artifact-converter/src/test/target-repository/test/unmodified-artifact/1.0.0/unmodified-artifact-1.0.0.jar 查看文件

@@ -0,0 +1 @@
unmodified

+ 25
- 0
archiva-base/maven-artifact-converter/src/test/target-repository/test/unmodified-artifact/1.0.0/unmodified-artifact-1.0.0.pom 查看文件

@@ -0,0 +1,25 @@
<!--
~ 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>

Loading…
取消
儲存