maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rfscho...@apache.org
Subject svn commit: r1722968 - in /maven/plugins/trunk/maven-assembly-plugin: ./ src/main/java/org/apache/maven/plugins/assembly/archive/phase/wrappers/ src/main/java/org/apache/maven/plugins/assembly/repository/
Date Mon, 04 Jan 2016 22:33:38 GMT
Author: rfscholte
Date: Mon Jan  4 22:33:38 2016
New Revision: 1722968

URL: http://svn.apache.org/viewvc?rev=1722968&view=rev
Log:
Remove generation of metadata and checksum files, already done by Aether.
maven-compat back to test scope, yeah!

Modified:
    maven/plugins/trunk/maven-assembly-plugin/pom.xml
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/archive/phase/wrappers/RepoBuilderConfigSourceWrapper.java
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/DefaultRepositoryAssembler.java
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/RepositoryBuilderConfigSource.java

Modified: maven/plugins/trunk/maven-assembly-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/pom.xml?rev=1722968&r1=1722967&r2=1722968&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-assembly-plugin/pom.xml Mon Jan  4 22:33:38 2016
@@ -93,7 +93,7 @@ under the License.
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-compat</artifactId>
       <version>${mavenVersion}</version>
-<!-- <scope>test</scope> -->
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/archive/phase/wrappers/RepoBuilderConfigSourceWrapper.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/archive/phase/wrappers/RepoBuilderConfigSourceWrapper.java?rev=1722968&r1=1722967&r2=1722968&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/archive/phase/wrappers/RepoBuilderConfigSourceWrapper.java
(original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/archive/phase/wrappers/RepoBuilderConfigSourceWrapper.java
Mon Jan  4 22:33:38 2016
@@ -19,7 +19,6 @@ package org.apache.maven.plugins.assembl
  * under the License.
  */
 
-import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.plugins.assembly.AssemblerConfigurationSource;
 import org.apache.maven.plugins.assembly.repository.RepositoryBuilderConfigSource;
 import org.apache.maven.project.MavenProject;
@@ -40,12 +39,6 @@ public class RepoBuilderConfigSourceWrap
     }
 
     @Override
-    public ArtifactRepository getLocalRepository()
-    {
-        return configSource.getLocalRepository();
-    }
-
-    @Override
     public MavenProject getProject()
     {
         return configSource.getProject();

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/DefaultRepositoryAssembler.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/DefaultRepositoryAssembler.java?rev=1722968&r1=1722967&r2=1722968&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/DefaultRepositoryAssembler.java
(original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/DefaultRepositoryAssembler.java
Mon Jan  4 22:33:38 2016
@@ -19,34 +19,16 @@ package org.apache.maven.plugins.assembl
  * under the License.
  */
 
-import static org.apache.commons.codec.digest.DigestUtils.md5Hex;
-import static org.apache.commons.codec.digest.DigestUtils.shaHex;
-
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileWriter;
 import java.io.IOException;
-import java.io.Writer;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.TimeZone;
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
-import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
-import org.apache.maven.artifact.repository.metadata.Versioning;
-import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Writer;
 import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 import org.apache.maven.model.Dependency;
@@ -65,7 +47,6 @@ import org.apache.maven.shared.dependenc
 import org.apache.maven.shared.dependency.resolve.DependencyResolverException;
 import org.apache.maven.shared.repository.RepositoryManager;
 import org.apache.maven.shared.utils.io.FileUtils;
-import org.apache.maven.shared.utils.io.IOUtil;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
@@ -81,20 +62,10 @@ public class DefaultRepositoryAssembler
     extends AbstractLogEnabled
     implements RepositoryAssembler
 {
-    protected static final TimeZone UTC_TIME_ZONE = TimeZone.getTimeZone( "UTC" );
-
-    protected static final String UTC_TIMESTAMP_PATTERN = "yyyyMMddHHmmss";
-
     @Requirement
     protected ArtifactResolver artifactResolver;
 
     @Requirement
-    protected ArtifactRepositoryLayout repositoryLayout;
-
-    @Requirement
-    protected ArtifactRepositoryFactory artifactRepositoryFactory;
-
-    @Requirement
     private DependencyResolver dependencyResolver;
 
     @Requirement
@@ -105,7 +76,6 @@ public class DefaultRepositoryAssembler
                                            throws RepositoryAssemblyException
     {
         MavenProject project = configSource.getProject();
-        ArtifactRepository localRepository = configSource.getLocalRepository();
         ProjectBuildingRequest buildingRequest = configSource.getProjectBuildingRequest();
 
         Iterable<ArtifactResult> result = null;
@@ -151,18 +121,14 @@ public class DefaultRepositoryAssembler
 
         buildingRequest = repositoryManager.setLocalRepositoryBasedir( buildingRequest, repositoryDirectory
);
 
-        ArtifactRepository targetRepository = createLocalRepository( repositoryDirectory
);
-
         Map<String, GroupVersionAlignment> groupVersionAlignments =
             createGroupVersionAlignments( repository.getGroupVersionAlignments() );
 
         assembleRepositoryArtifacts( buildingRequest, result, filter, groupVersionAlignments
);
 
-        ArtifactRepository centralRepository = findCentralRepository( project );
-
         if ( repository.isIncludeMetadata() )
         {
-            assembleRepositoryMetadata( result, filter, centralRepository, targetRepository
);
+//            assembleRepositoryMetadata( result, filter, centralRepository, targetRepository
);
         }
 
         try
@@ -260,7 +226,7 @@ public class DefaultRepositoryAssembler
                     
                     FileUtils.copyFile( a.getFile(), targetFile );
 
-                    writeChecksums( targetFile );
+//                    writeChecksums( targetFile );
                 }
             }
         }
@@ -274,103 +240,6 @@ public class DefaultRepositoryAssembler
         }
     }
 
-    private ArtifactRepository findCentralRepository( MavenProject project )
-    {
-        ArtifactRepository centralRepository = null;
-        for ( ArtifactRepository r : project.getRemoteArtifactRepositories() )
-        {
-            if ( "central".equals( r.getId() ) )
-            {
-                centralRepository = r;
-            }
-        }
-
-        return centralRepository;
-    }
-
-    private void assembleRepositoryMetadata( Iterable<ArtifactResult> result, ArtifactFilter
filter,
-                                             ArtifactRepository centralRepository, ArtifactRepository
targetRepository )
-                                                 throws RepositoryAssemblyException
-    {
-        for ( ArtifactResult ar : result )
-        {
-            Artifact a = ar.getArtifact();
-
-            if ( filter.include( a ) )
-            {
-                Versioning v = new Versioning();
-
-                v.setRelease( a.getVersion() );
-
-                v.setLatest( a.getVersion() );
-
-                v.addVersion( a.getVersion() );
-
-                v.setLastUpdated( getUtcDateFormatter().format( new Date() ) );
-
-                ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( a,
v );
-                String path = targetRepository.pathOfLocalRepositoryMetadata( metadata, centralRepository
);
-                File metadataFile = new File( targetRepository.getBasedir(), path );
-
-                MetadataXpp3Writer metadataWriter = new MetadataXpp3Writer();
-
-                Writer writer = null;
-                try
-                {
-                    writer = new FileWriter( metadataFile );
-
-                    metadataWriter.write( writer, metadata.getMetadata() );
-                }
-                catch ( IOException e )
-                {
-                    throw new RepositoryAssemblyException( "Error writing artifact metdata.",
e );
-                }
-                finally
-                {
-                    IOUtil.close( writer );
-                }
-
-                try
-                {
-                    writeChecksums( metadataFile );
-
-                    File metadataFileRemote = new File( targetRepository.getBasedir(),
-                                                        targetRepository.pathOfRemoteRepositoryMetadata(
metadata ) );
-
-                    FileUtils.copyFile( metadataFile, metadataFileRemote );
-
-                    FileUtils.copyFile( new File( metadataFile.getParentFile(), metadataFile.getName()
+ ".sha1" ),
-                                        new File( metadataFileRemote.getParentFile(),
-                                                  metadataFileRemote.getName() + ".sha1"
) );
-
-                    FileUtils.copyFile( new File( metadataFile.getParentFile(), metadataFile.getName()
+ ".md5" ),
-                                        new File( metadataFileRemote.getParentFile(),
-                                                  metadataFileRemote.getName() + ".md5" )
);
-                }
-                catch ( IOException e )
-                {
-                    throw new RepositoryAssemblyException( "Error writing artifact metdata.",
e );
-                }
-            }
-        }
-    }
-
-    private void writeChecksums( File file )
-        throws IOException, RepositoryAssemblyException
-    {
-        FileInputStream data = new FileInputStream( file );
-        String md5 = md5Hex( data ).toUpperCase();
-        data.close();
-        FileInputStream data1 = new FileInputStream( file );
-        String sha1 = shaHex( data1 ).toUpperCase();
-        data1.close();
-
-        FileUtils.fileWrite( new File( file.getParentFile(), file.getName() + ".md5" ).getAbsolutePath(),
-                             md5.toLowerCase() );
-        FileUtils.fileWrite( new File( file.getParentFile(), file.getName() + ".sha1" ).getAbsolutePath(),
-                             sha1.toLowerCase() );
-    }
-
     // CHECKSTYLE_OFF: LineLength
     protected Map<String, GroupVersionAlignment> createGroupVersionAlignments( List<GroupVersionAlignment>
versionAlignments )
     // CHECKSTYLE_ON: LineLength
@@ -388,49 +257,6 @@ public class DefaultRepositoryAssembler
         return groupVersionAlignments;
     }
 
-    protected static DateFormat getUtcDateFormatter()
-    {
-        DateFormat utcDateFormatter = new SimpleDateFormat( UTC_TIMESTAMP_PATTERN );
-        utcDateFormatter.setTimeZone( UTC_TIME_ZONE );
-        return utcDateFormatter;
-    }
-
-    protected ArtifactRepository createLocalRepository( File directory )
-    {
-        String localRepositoryUrl = directory.getAbsolutePath();
-
-        if ( !localRepositoryUrl.startsWith( "file:" ) )
-        {
-            localRepositoryUrl = "file://" + localRepositoryUrl;
-        }
-
-        return createRepository( "local", localRepositoryUrl, false, true,
-                                 ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN );
-    }
-
-    public ArtifactRepository createRepository( String repositoryId, String repositoryUrl,
boolean offline,
-                                                boolean updateSnapshots, String globalChecksumPolicy
)
-    {
-        ArtifactRepository localRepository =
-            new DefaultArtifactRepository( repositoryId, repositoryUrl, repositoryLayout
);
-
-        boolean snapshotPolicySet = false;
-
-        if ( offline )
-        {
-            snapshotPolicySet = true;
-        }
-
-        if ( !snapshotPolicySet && updateSnapshots )
-        {
-            artifactRepositoryFactory.setGlobalUpdatePolicy( ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS
);
-        }
-
-        artifactRepositoryFactory.setGlobalChecksumPolicy( globalChecksumPolicy );
-
-        return localRepository;
-    }
-
     private void setAlignment( Artifact artifact, Map<String, GroupVersionAlignment>
groupVersionAlignments )
     {
         GroupVersionAlignment alignment = groupVersionAlignments.get( artifact.getGroupId()
);

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/RepositoryBuilderConfigSource.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/RepositoryBuilderConfigSource.java?rev=1722968&r1=1722967&r2=1722968&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/RepositoryBuilderConfigSource.java
(original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/RepositoryBuilderConfigSource.java
Mon Jan  4 22:33:38 2016
@@ -19,7 +19,6 @@ package org.apache.maven.plugins.assembl
  * under the License.
  */
 
-import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.ProjectBuildingRequest;
 
@@ -31,8 +30,6 @@ public interface RepositoryBuilderConfig
 
     MavenProject getProject();
 
-    ArtifactRepository getLocalRepository();
-    
     ProjectBuildingRequest getProjectBuildingRequest();
 
 }



Mime
View raw message