You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2022/06/28 20:24:08 UTC

[maven-assembly-plugin] branch master updated: [MASSEMBLY-961] Update maven-archiver to 3.6.0 (#70)

This is an automated email from the ASF dual-hosted git repository.

cstamas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-assembly-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 93775025 [MASSEMBLY-961] Update maven-archiver to 3.6.0 (#70)
93775025 is described below

commit 937750250bfe06333f92351fa1a19a9cd5e59d28
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Tue Jun 28 22:24:04 2022 +0200

    [MASSEMBLY-961] Update maven-archiver to 3.6.0 (#70)
    
    Upgrade:
    * plexus-io to 3.4.0
    * plexus-archiver to 4.4.0
    * maven-archiver to 3.6.0 (when released)
    
    These are now pure JSR330 components, and legacy APIs are dropped, so drop whatever cruft needed from assembly plugin as well.
---
 pom.xml                                            | 26 ++-----
 src/it/projects/reproducible/verify.groovy         |  2 +-
 .../assembly/archive/DefaultAssemblyArchiver.java  |  8 +-
 .../archive/archiver/AssemblyProxyArchiver.java    | 18 +++++
 .../internal/DebugConfigurationListener.java       | 90 ++++++++++++++++++++++
 .../assembly/internal/PlexusLoggingHelper.java     | 39 ----------
 6 files changed, 120 insertions(+), 63 deletions(-)

diff --git a/pom.xml b/pom.xml
index ada9d5a6..e3dfe137 100644
--- a/pom.xml
+++ b/pom.xml
@@ -156,23 +156,7 @@ under the License.
       <artifactId>plexus-interpolation</artifactId>
       <version>1.26</version>
     </dependency>
-    <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-slf4j-logging</artifactId>
-      <version>1.1</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.codehaus.plexus</groupId>
-          <artifactId>plexus-container-default</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
 
-    <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-archiver</artifactId>
-      <version>4.2.7</version>
-    </dependency>
     <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
@@ -186,13 +170,19 @@ under the License.
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-io</artifactId>
-      <version>3.3.1</version>
+      <version>3.4.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-archiver</artifactId>
+      <version>4.4.0</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-archiver</artifactId>
-      <version>3.5.2</version>
+      <version>3.6.0</version>
     </dependency>
+
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-utils</artifactId>
diff --git a/src/it/projects/reproducible/verify.groovy b/src/it/projects/reproducible/verify.groovy
index 14b429c7..798c2fb8 100644
--- a/src/it/projects/reproducible/verify.groovy
+++ b/src/it/projects/reproducible/verify.groovy
@@ -27,4 +27,4 @@ assert deployDir.exists()
 
 assert new File( deployDir, 'reproducible-1.0-src.zip.sha1' ).text == '5ce34fc133d47cbc9c81195877dbe10b9ec7d864'
 assert new File( deployDir, 'reproducible-1.0-src.tar.sha1' ).text == '0b9dc1da069705a93b4954a198c18bd248822bf8'
-assert new File( deployDir, 'reproducible-1.0-src.jar.sha1' ).text == '2e84c54834ad80e58b4564471a02356904c7b1e3'
+assert new File( deployDir, 'reproducible-1.0-src.jar.sha1' ).text == '289cb3ecd418b8099deefb930dc7aa39c06888cb'
diff --git a/src/main/java/org/apache/maven/plugins/assembly/archive/DefaultAssemblyArchiver.java b/src/main/java/org/apache/maven/plugins/assembly/archive/DefaultAssemblyArchiver.java
index 116b7515..b933b8f0 100644
--- a/src/main/java/org/apache/maven/plugins/assembly/archive/DefaultAssemblyArchiver.java
+++ b/src/main/java/org/apache/maven/plugins/assembly/archive/DefaultAssemblyArchiver.java
@@ -22,7 +22,6 @@ package org.apache.maven.plugins.assembly.archive;
 import javax.inject.Inject;
 import javax.inject.Named;
 
-import org.apache.maven.plugin.DebugConfigurationListener;
 import org.apache.maven.plugins.assembly.AssemblerConfigurationSource;
 import org.apache.maven.plugins.assembly.InvalidAssemblerConfigurationException;
 import org.apache.maven.plugins.assembly.archive.archiver.AssemblyProxyArchiver;
@@ -32,7 +31,7 @@ import org.apache.maven.plugins.assembly.artifact.DependencyResolutionException;
 import org.apache.maven.plugins.assembly.filter.ComponentsXmlArchiverFileFilter;
 import org.apache.maven.plugins.assembly.filter.ContainerDescriptorHandler;
 import org.apache.maven.plugins.assembly.format.AssemblyFormattingException;
-import org.apache.maven.plugins.assembly.internal.PlexusLoggingHelper;
+import org.apache.maven.plugins.assembly.internal.DebugConfigurationListener;
 import org.apache.maven.plugins.assembly.interpolation.AssemblyExpressionEvaluator;
 import org.apache.maven.plugins.assembly.model.Assembly;
 import org.apache.maven.plugins.assembly.model.ContainerDescriptorHandlerConfig;
@@ -332,7 +331,7 @@ public class DefaultAssemblyArchiver implements AssemblyArchiver
                                               configSource.getWorkingDirectory() );
         if ( configSource.isDryRun() )
         {
-            archiver = new DryRunArchiver( archiver, PlexusLoggingHelper.wrap( LOGGER ) );
+            archiver = new DryRunArchiver( archiver, LOGGER );
         }
 
         archiver.setUseJvmChmod( configSource.isUpdateOnly() );
@@ -427,8 +426,7 @@ public class DefaultAssemblyArchiver implements AssemblyArchiver
     {
         final ComponentConfigurator configurator = container.lookup( ComponentConfigurator.class, "basic" );
 
-        final ConfigurationListener listener = new DebugConfigurationListener(
-                PlexusLoggingHelper.wrap( LOGGER ) );
+        final ConfigurationListener listener = new DebugConfigurationListener( LOGGER );
 
         final ExpressionEvaluator expressionEvaluator = new AssemblyExpressionEvaluator( configSource );
 
diff --git a/src/main/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiver.java b/src/main/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiver.java
index cf009982..49382db4 100644
--- a/src/main/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiver.java
+++ b/src/main/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiver.java
@@ -42,6 +42,7 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.Charset;
+import java.nio.file.attribute.FileTime;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Comparator;
@@ -1099,4 +1100,21 @@ public class AssemblyProxyArchiver implements Archiver
         return delegate.getOverrideGroupName();
     }
 
+    @Override
+    public void setLastModifiedTime( FileTime fileTime )
+    {
+        delegate.setLastModifiedTime( fileTime );
+    }
+
+    @Override
+    public FileTime getLastModifiedTime()
+    {
+        return delegate.getLastModifiedTime();
+    }
+
+    @Override
+    public void configureReproducibleBuild( FileTime fileTime )
+    {
+        delegate.configureReproducibleBuild( fileTime );
+    }
 }
diff --git a/src/main/java/org/apache/maven/plugins/assembly/internal/DebugConfigurationListener.java b/src/main/java/org/apache/maven/plugins/assembly/internal/DebugConfigurationListener.java
new file mode 100644
index 00000000..5da66aca
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/assembly/internal/DebugConfigurationListener.java
@@ -0,0 +1,90 @@
+package org.apache.maven.plugins.assembly.internal;
+
+/*
+ * 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.lang.reflect.Array;
+
+import org.codehaus.plexus.component.configurator.ConfigurationListener;
+import org.slf4j.Logger;
+
+/**
+ * Copy of deprecated {@link org.apache.maven.plugin.DebugConfigurationListener} updated to Slf4j.
+ */
+public class DebugConfigurationListener
+        implements ConfigurationListener
+{
+    private final Logger logger;
+
+    public DebugConfigurationListener( Logger logger )
+    {
+        this.logger = logger;
+    }
+
+    @Override
+    public void notifyFieldChangeUsingSetter( String fieldName, Object value, Object target )
+    {
+        if ( logger.isDebugEnabled() )
+        {
+            logger.debug( "  (s) " + fieldName + " = " + toString( value ) );
+        }
+    }
+
+    @Override
+    public void notifyFieldChangeUsingReflection( String fieldName, Object value, Object target )
+    {
+        if ( logger.isDebugEnabled() )
+        {
+            logger.debug( "  (f) " + fieldName + " = " + toString( value ) );
+        }
+    }
+
+    /**
+     * Creates a human-friendly string representation of the specified object.
+     *
+     * @param obj The object to create a string representation for, may be <code>null</code>.
+     * @return The string representation, never <code>null</code>.
+     */
+    private String toString( Object obj )
+    {
+        String str;
+        if ( obj != null && obj.getClass().isArray() )
+        {
+            int n = Array.getLength( obj );
+            StringBuilder buf = new StringBuilder( 256 );
+            buf.append( '[' );
+            for ( int i = 0; i < n; i++ )
+            {
+                if ( i > 0 )
+                {
+                    buf.append( ", " );
+                }
+                buf.append( Array.get( obj, i ) );
+            }
+            buf.append( ']' );
+            str = buf.toString();
+        }
+        else
+        {
+            str = String.valueOf( obj );
+        }
+        return str;
+    }
+
+}
diff --git a/src/main/java/org/apache/maven/plugins/assembly/internal/PlexusLoggingHelper.java b/src/main/java/org/apache/maven/plugins/assembly/internal/PlexusLoggingHelper.java
deleted file mode 100644
index 6708a9c7..00000000
--- a/src/main/java/org/apache/maven/plugins/assembly/internal/PlexusLoggingHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.apache.maven.plugins.assembly.internal;
-
-/*
- * 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.logging.Logger;
-import org.codehaus.plexus.logging.slf4j.Slf4jLogger;
-
-/**
- * Support for plexus logging, as downstream component APIs still expect Plexus logger..
- */
-public final class PlexusLoggingHelper
-{
-    private PlexusLoggingHelper()
-    {
-        // nop
-    }
-
-    public static Logger wrap( final org.slf4j.Logger logger )
-    {
-        return new Slf4jLogger( 0, logger ); // set it lowest level, let SLF4J filter
-    }
-}