Skip to content

Commit

Permalink
[MASSEMBLY-961] Update maven-archiver to 3.6.0 (#70)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cstamas authored Jun 28, 2022
1 parent 0635269 commit 9377502
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 63 deletions.
26 changes: 8 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/it/projects/reproducible/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
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;
Expand All @@ -32,7 +31,7 @@
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;
Expand Down Expand Up @@ -332,7 +331,7 @@ else if ( "war".equals( format ) )
configSource.getWorkingDirectory() );
if ( configSource.isDryRun() )
{
archiver = new DryRunArchiver( archiver, PlexusLoggingHelper.wrap( LOGGER ) );
archiver = new DryRunArchiver( archiver, LOGGER );
}

archiver.setUseJvmChmod( configSource.isUpdateOnly() );
Expand Down Expand Up @@ -427,8 +426,7 @@ private void configureComponent( final Object component, final Xpp3Dom config,
{
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 );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
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;
Expand Down Expand Up @@ -1099,4 +1100,21 @@ public String getOverrideGroupName()
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 );
}
}
Original file line number Diff line number Diff line change
@@ -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;
}

}

This file was deleted.

0 comments on commit 9377502

Please sign in to comment.