Skip to content

Commit 9377502

Browse files
authored
[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.
1 parent 0635269 commit 9377502

File tree

6 files changed

+120
-63
lines changed

6 files changed

+120
-63
lines changed

Diff for: pom.xml

+8-18
Original file line numberDiff line numberDiff line change
@@ -156,23 +156,7 @@ under the License.
156156
<artifactId>plexus-interpolation</artifactId>
157157
<version>1.26</version>
158158
</dependency>
159-
<dependency>
160-
<groupId>org.codehaus.plexus</groupId>
161-
<artifactId>plexus-slf4j-logging</artifactId>
162-
<version>1.1</version>
163-
<exclusions>
164-
<exclusion>
165-
<groupId>org.codehaus.plexus</groupId>
166-
<artifactId>plexus-container-default</artifactId>
167-
</exclusion>
168-
</exclusions>
169-
</dependency>
170159

171-
<dependency>
172-
<groupId>org.codehaus.plexus</groupId>
173-
<artifactId>plexus-archiver</artifactId>
174-
<version>4.2.7</version>
175-
</dependency>
176160
<dependency>
177161
<groupId>commons-io</groupId>
178162
<artifactId>commons-io</artifactId>
@@ -186,13 +170,19 @@ under the License.
186170
<dependency>
187171
<groupId>org.codehaus.plexus</groupId>
188172
<artifactId>plexus-io</artifactId>
189-
<version>3.3.1</version>
173+
<version>3.4.0</version>
174+
</dependency>
175+
<dependency>
176+
<groupId>org.codehaus.plexus</groupId>
177+
<artifactId>plexus-archiver</artifactId>
178+
<version>4.4.0</version>
190179
</dependency>
191180
<dependency>
192181
<groupId>org.apache.maven</groupId>
193182
<artifactId>maven-archiver</artifactId>
194-
<version>3.5.2</version>
183+
<version>3.6.0</version>
195184
</dependency>
185+
196186
<dependency>
197187
<groupId>org.codehaus.plexus</groupId>
198188
<artifactId>plexus-utils</artifactId>

Diff for: src/it/projects/reproducible/verify.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ assert deployDir.exists()
2727

2828
assert new File( deployDir, 'reproducible-1.0-src.zip.sha1' ).text == '5ce34fc133d47cbc9c81195877dbe10b9ec7d864'
2929
assert new File( deployDir, 'reproducible-1.0-src.tar.sha1' ).text == '0b9dc1da069705a93b4954a198c18bd248822bf8'
30-
assert new File( deployDir, 'reproducible-1.0-src.jar.sha1' ).text == '2e84c54834ad80e58b4564471a02356904c7b1e3'
30+
assert new File( deployDir, 'reproducible-1.0-src.jar.sha1' ).text == '289cb3ecd418b8099deefb930dc7aa39c06888cb'

Diff for: src/main/java/org/apache/maven/plugins/assembly/archive/DefaultAssemblyArchiver.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import javax.inject.Inject;
2323
import javax.inject.Named;
2424

25-
import org.apache.maven.plugin.DebugConfigurationListener;
2625
import org.apache.maven.plugins.assembly.AssemblerConfigurationSource;
2726
import org.apache.maven.plugins.assembly.InvalidAssemblerConfigurationException;
2827
import org.apache.maven.plugins.assembly.archive.archiver.AssemblyProxyArchiver;
@@ -32,7 +31,7 @@
3231
import org.apache.maven.plugins.assembly.filter.ComponentsXmlArchiverFileFilter;
3332
import org.apache.maven.plugins.assembly.filter.ContainerDescriptorHandler;
3433
import org.apache.maven.plugins.assembly.format.AssemblyFormattingException;
35-
import org.apache.maven.plugins.assembly.internal.PlexusLoggingHelper;
34+
import org.apache.maven.plugins.assembly.internal.DebugConfigurationListener;
3635
import org.apache.maven.plugins.assembly.interpolation.AssemblyExpressionEvaluator;
3736
import org.apache.maven.plugins.assembly.model.Assembly;
3837
import org.apache.maven.plugins.assembly.model.ContainerDescriptorHandlerConfig;
@@ -332,7 +331,7 @@ else if ( "war".equals( format ) )
332331
configSource.getWorkingDirectory() );
333332
if ( configSource.isDryRun() )
334333
{
335-
archiver = new DryRunArchiver( archiver, PlexusLoggingHelper.wrap( LOGGER ) );
334+
archiver = new DryRunArchiver( archiver, LOGGER );
336335
}
337336

338337
archiver.setUseJvmChmod( configSource.isUpdateOnly() );
@@ -427,8 +426,7 @@ private void configureComponent( final Object component, final Xpp3Dom config,
427426
{
428427
final ComponentConfigurator configurator = container.lookup( ComponentConfigurator.class, "basic" );
429428

430-
final ConfigurationListener listener = new DebugConfigurationListener(
431-
PlexusLoggingHelper.wrap( LOGGER ) );
429+
final ConfigurationListener listener = new DebugConfigurationListener( LOGGER );
432430

433431
final ExpressionEvaluator expressionEvaluator = new AssemblyExpressionEvaluator( configSource );
434432

Diff for: src/main/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiver.java

+18
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import java.io.IOException;
4343
import java.io.InputStream;
4444
import java.nio.charset.Charset;
45+
import java.nio.file.attribute.FileTime;
4546
import java.util.ArrayList;
4647
import java.util.Arrays;
4748
import java.util.Comparator;
@@ -1099,4 +1100,21 @@ public String getOverrideGroupName()
10991100
return delegate.getOverrideGroupName();
11001101
}
11011102

1103+
@Override
1104+
public void setLastModifiedTime( FileTime fileTime )
1105+
{
1106+
delegate.setLastModifiedTime( fileTime );
1107+
}
1108+
1109+
@Override
1110+
public FileTime getLastModifiedTime()
1111+
{
1112+
return delegate.getLastModifiedTime();
1113+
}
1114+
1115+
@Override
1116+
public void configureReproducibleBuild( FileTime fileTime )
1117+
{
1118+
delegate.configureReproducibleBuild( fileTime );
1119+
}
11021120
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
package org.apache.maven.plugins.assembly.internal;
2+
3+
/*
4+
* Licensed to the Apache Software Foundation (ASF) under one
5+
* or more contributor license agreements. See the NOTICE file
6+
* distributed with this work for additional information
7+
* regarding copyright ownership. The ASF licenses this file
8+
* to you under the Apache License, Version 2.0 (the
9+
* "License"); you may not use this file except in compliance
10+
* with the License. You may obtain a copy of the License at
11+
*
12+
* http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing,
15+
* software distributed under the License is distributed on an
16+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
* KIND, either express or implied. See the License for the
18+
* specific language governing permissions and limitations
19+
* under the License.
20+
*/
21+
22+
import java.lang.reflect.Array;
23+
24+
import org.codehaus.plexus.component.configurator.ConfigurationListener;
25+
import org.slf4j.Logger;
26+
27+
/**
28+
* Copy of deprecated {@link org.apache.maven.plugin.DebugConfigurationListener} updated to Slf4j.
29+
*/
30+
public class DebugConfigurationListener
31+
implements ConfigurationListener
32+
{
33+
private final Logger logger;
34+
35+
public DebugConfigurationListener( Logger logger )
36+
{
37+
this.logger = logger;
38+
}
39+
40+
@Override
41+
public void notifyFieldChangeUsingSetter( String fieldName, Object value, Object target )
42+
{
43+
if ( logger.isDebugEnabled() )
44+
{
45+
logger.debug( " (s) " + fieldName + " = " + toString( value ) );
46+
}
47+
}
48+
49+
@Override
50+
public void notifyFieldChangeUsingReflection( String fieldName, Object value, Object target )
51+
{
52+
if ( logger.isDebugEnabled() )
53+
{
54+
logger.debug( " (f) " + fieldName + " = " + toString( value ) );
55+
}
56+
}
57+
58+
/**
59+
* Creates a human-friendly string representation of the specified object.
60+
*
61+
* @param obj The object to create a string representation for, may be <code>null</code>.
62+
* @return The string representation, never <code>null</code>.
63+
*/
64+
private String toString( Object obj )
65+
{
66+
String str;
67+
if ( obj != null && obj.getClass().isArray() )
68+
{
69+
int n = Array.getLength( obj );
70+
StringBuilder buf = new StringBuilder( 256 );
71+
buf.append( '[' );
72+
for ( int i = 0; i < n; i++ )
73+
{
74+
if ( i > 0 )
75+
{
76+
buf.append( ", " );
77+
}
78+
buf.append( Array.get( obj, i ) );
79+
}
80+
buf.append( ']' );
81+
str = buf.toString();
82+
}
83+
else
84+
{
85+
str = String.valueOf( obj );
86+
}
87+
return str;
88+
}
89+
90+
}

Diff for: src/main/java/org/apache/maven/plugins/assembly/internal/PlexusLoggingHelper.java

-39
This file was deleted.

0 commit comments

Comments
 (0)