mirror of https://github.com/apache/maven.git
o Fixed, pending changes to DefaultRepositoryLayout as outlined in MNG-321
PR: MNG-332 git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163990 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0e5b4e565c
commit
666c60dea6
|
@ -25,6 +25,8 @@ import org.apache.maven.tools.repoclean.digest.ArtifactDigestVerifier;
|
||||||
import org.apache.maven.tools.repoclean.discover.ArtifactDiscoverer;
|
import org.apache.maven.tools.repoclean.discover.ArtifactDiscoverer;
|
||||||
import org.apache.maven.tools.repoclean.index.ArtifactIndexer;
|
import org.apache.maven.tools.repoclean.index.ArtifactIndexer;
|
||||||
import org.apache.maven.tools.repoclean.report.FileReporter;
|
import org.apache.maven.tools.repoclean.report.FileReporter;
|
||||||
|
import org.apache.maven.tools.repoclean.report.ReportWriteException;
|
||||||
|
import org.apache.maven.tools.repoclean.report.Reporter;
|
||||||
import org.apache.maven.tools.repoclean.rewrite.ArtifactPomRewriter;
|
import org.apache.maven.tools.repoclean.rewrite.ArtifactPomRewriter;
|
||||||
import org.codehaus.plexus.PlexusConstants;
|
import org.codehaus.plexus.PlexusConstants;
|
||||||
import org.codehaus.plexus.PlexusContainer;
|
import org.codehaus.plexus.PlexusContainer;
|
||||||
|
@ -62,6 +64,8 @@ public class RepositoryCleaner
|
||||||
|
|
||||||
private ArtifactDigestVerifier artifactDigestVerifier;
|
private ArtifactDigestVerifier artifactDigestVerifier;
|
||||||
|
|
||||||
|
private ArtifactRepositoryLayout bridgingLayout;
|
||||||
|
|
||||||
private MailSender mailSender;
|
private MailSender mailSender;
|
||||||
|
|
||||||
private ArtifactIndexer artifactIndexer;
|
private ArtifactIndexer artifactIndexer;
|
||||||
|
@ -338,10 +342,14 @@ public class RepositoryCleaner
|
||||||
|
|
||||||
File targetPom = new File( targetRepositoryBase, targetRepo.pathOfMetadata( pom ) );
|
File targetPom = new File( targetRepositoryBase, targetRepo.pathOfMetadata( pom ) );
|
||||||
|
|
||||||
|
File bridgedTargetPom = new File( targetRepositoryBase, bridgingLayout.pathOfMetadata( pom ) );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
artifactPomRewriter.rewrite( artifact, sourcePom, targetPom, artifactReporter,
|
artifactPomRewriter.rewrite( artifact, sourcePom, targetPom, artifactReporter,
|
||||||
configuration.reportOnly() );
|
configuration.reportOnly() );
|
||||||
|
|
||||||
|
bridgePomLocations( targetPom, bridgedTargetPom, artifactReporter );
|
||||||
}
|
}
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
{
|
{
|
||||||
|
@ -393,6 +401,30 @@ public class RepositoryCleaner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void bridgePomLocations( File targetPom, File bridgedTargetPom, Reporter reporter ) throws IOException, ReportWriteException
|
||||||
|
{
|
||||||
|
if(targetPom.equals(bridgedTargetPom))
|
||||||
|
{
|
||||||
|
reporter.warn("Cannot create legacy-compatible copy of POM at: " + targetPom + "; legacy-compatible path is the same as the converted POM itself.");
|
||||||
|
}
|
||||||
|
|
||||||
|
FileInputStream in = null;
|
||||||
|
FileOutputStream out = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
in = new FileInputStream(targetPom);
|
||||||
|
out = new FileOutputStream(bridgedTargetPom);
|
||||||
|
|
||||||
|
IOUtil.copy(in, out);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IOUtil.close(in);
|
||||||
|
IOUtil.close(out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private String buildArtifactReportPath( Artifact artifact )
|
private String buildArtifactReportPath( Artifact artifact )
|
||||||
{
|
{
|
||||||
String classifier = artifact.getClassifier();
|
String classifier = artifact.getClassifier();
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
package org.apache.maven.tools.repoclean.artifact.layout;
|
||||||
|
|
||||||
|
import org.apache.maven.artifact.Artifact;
|
||||||
|
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||||
|
import org.apache.maven.artifact.repository.layout.ArtifactPathFormatException;
|
||||||
|
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright 2001-2005 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AlphaBridgingRepositoryLayout
|
||||||
|
extends DefaultRepositoryLayout
|
||||||
|
{
|
||||||
|
|
||||||
|
public String pathOfMetadata( ArtifactMetadata metadata )
|
||||||
|
throws ArtifactPathFormatException
|
||||||
|
{
|
||||||
|
Artifact artifact = metadata.getArtifact();
|
||||||
|
|
||||||
|
StringBuffer path = new StringBuffer();
|
||||||
|
|
||||||
|
path.append( artifact.getGroupId().replace( '.', '/' ) ).append( '/' );
|
||||||
|
path.append( artifact.getArtifactId() ).append( '/' );
|
||||||
|
path.append( artifact.getBaseVersion() ).append( '/' );
|
||||||
|
path.append( metadata.getFilename() );
|
||||||
|
|
||||||
|
return path.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,15 @@
|
||||||
<component-set>
|
<component-set>
|
||||||
<components>
|
<components>
|
||||||
|
<component>
|
||||||
|
<role>org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout</role>
|
||||||
|
<role-hint>alpha-bridging</role-hint>
|
||||||
|
<implementation>org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout</implementation>
|
||||||
|
<requirements>
|
||||||
|
<requirement>
|
||||||
|
<role>org.apache.maven.artifact.handler.manager.ArtifactHandlerManager</role>
|
||||||
|
</requirement>
|
||||||
|
</requirements>
|
||||||
|
</component>
|
||||||
<!--
|
<!--
|
||||||
|
|
|
|
||||||
|
|
|
|
||||||
|
@ -99,6 +109,11 @@
|
||||||
<role>org.apache.maven.tools.repoclean.RepositoryCleaner</role>
|
<role>org.apache.maven.tools.repoclean.RepositoryCleaner</role>
|
||||||
<implementation>org.apache.maven.tools.repoclean.RepositoryCleaner</implementation>
|
<implementation>org.apache.maven.tools.repoclean.RepositoryCleaner</implementation>
|
||||||
<requirements>
|
<requirements>
|
||||||
|
<requirement>
|
||||||
|
<role>org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout</role>
|
||||||
|
<role-hint>alpha-bridging</role-hint>
|
||||||
|
<field-name>bridgingLayout</field-name>
|
||||||
|
</requirement>
|
||||||
<requirement>
|
<requirement>
|
||||||
<role>org.apache.maven.tools.repoclean.digest.ArtifactDigestVerifier</role>
|
<role>org.apache.maven.tools.repoclean.digest.ArtifactDigestVerifier</role>
|
||||||
</requirement>
|
</requirement>
|
||||||
|
|
Loading…
Reference in New Issue