Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.0-beta-4
-
Fix Version/s: 1.0
-
Component/s: WebDAV Interface
-
Labels:None
-
Number of attachments :
Description
requesting "junit/java-sources/junit-3.8.1-sources.jar" fails.
Path is converted internally to
groupId = junit
artifactId = junit
version = 3.8.1-sources
type = jar
I can publish a fix for this, but my workspace contains other modified code and I can hardly create a dedicated patch.
The idea is to create a ArtifactClassifierMapping similar to existing ArtifactExtensionMapping, and to use it in LegacyPathParser :
// Sanity Check: does extension match pathType on path?
String trimPathType = expectedType.substring( 0, expectedType.length() - 1 );String expectedExtension = ArtifactExtensionMapping.getExtension( trimPathType );
artifact.setType( expectedExtension );
String classifier = ArtifactClassifierMapping.getClassifier( trimPathType );
if ( classifier != null )
{
String version = artifact.getVersion();
if ( ! version.endsWith( "-" + classifier ) )
{ throw new LayoutException( INVALID_ARTIFACT_PATH + expectedType + " artifacts must use the classifier " + classifier ); }
version = version.substring( 0, version.length() - classifier.length() - 1 );
artifact.setVersion( version );
artifact.setClassifier( classifier );
}
The attached patch must be applied on archiva-repository-layer
it also require to :
Those two changes where not handled by my patch tool, as configured to binary types.
The idea of the patch is :
The patch contains
This will be easy in future to add support for other m1 "standard" types to classifier conversion. Typically for ejb-client jars (not sure what the correct classifier is)
- rename \src\test\repositories\legacy-repository\org.apache.maven\javadocs to javadoc.jars (in conformance to maven 1 javadoc plugin)
- move \src\test\repositories\legacy-repository\org.apache.maven\jars\testing-1.0-sources.jar to \src\test\repositories\legacy-repository\org.apache.maven\java-sources (in conformance to maven 1 source plugin).
Those two changes where not handled by my patch tool, as configured to binary types. The idea of the patch is :- remove the assertion that legacy path have no classifier. Simply have no way to support unstandard classifiers.
- automatically use "-javadoc" and "-sources" classifiers for path with types "javadoc.jars" and "java-sources". Check for the classifier to be detected in the version string and remove it.
The patch contains- modified code base
- updated test cases. Thanks to Joakim, this part has good test coverage and new tests are easy to add.
This will be easy in future to add support for other m1 "standard" types to classifier conversion. Typically for ejb-client jars (not sure what the correct classifier is)