Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ under the License.
<javaVersion>8</javaVersion>
<project.build.outputTimestamp>2022-03-05T18:51:54Z</project.build.outputTimestamp>
<slf4j.version>1.7.36</slf4j.version>
<plexus-archiver.version>4.6.0</plexus-archiver.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -176,7 +177,7 @@ under the License.
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-archiver</artifactId>
<version>4.2.2</version>
<version>${plexus-archiver.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
Expand Down
2 changes: 1 addition & 1 deletion src/it/projects/setup-custom-ear-lifecycle/manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ under the License.
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-archiver</artifactId>
<version>2.6.3</version>
<version>@plexus-archiver.version@</version>
</dependency>
</dependencies>

Expand Down
25 changes: 8 additions & 17 deletions src/it/projects/setup-custom-ear-lifecycle/plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.1</version>
<configuration>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
<executions>
<execution>
<id>mojo-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
</executions>
<version>3.7.0</version>
</plugin>
</plugins>
</build>
Expand All @@ -68,23 +57,25 @@ under the License.
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0.9</version>
<version>@mavenVersion@</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.0.9</version>
<artifactId>maven-core</artifactId>
<version>@mavenVersion@</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-archiver</artifactId>
<version>4.2.2</version>
<version>@plexus-archiver.version@</version>
</dependency>
<!-- dependencies to annotations -->
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.1</version>
<version>3.7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected void setUp()
assertNotNull( mojo );
assertNotNull( mojo.getProject() );

mojo.setArchiverManager( (ArchiverManager) lookup( ArchiverManager.ROLE ) );
mojo.setArchiverManager( lookup( ArchiverManager.class ) );

mojo.setMarkersDirectory( new File( this.testDir, "markers" ) );
mojo.setArtifactItems( list );
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.apache.maven.plugins.dependency.testUtils;

/*
/*
* 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
Expand Down Expand Up @@ -28,13 +28,19 @@
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.plugins.dependency.fromConfiguration.ArtifactItem;
import org.apache.maven.plugin.testing.ArtifactStubFactory;
import org.apache.maven.plugins.dependency.fromConfiguration.ArtifactItem;
import org.codehaus.plexus.archiver.Archiver;
import org.codehaus.plexus.archiver.ArchiverException;
import org.codehaus.plexus.archiver.manager.ArchiverManager;
import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
import org.codehaus.plexus.archiver.war.WarArchiver;

public class DependencyArtifactStubFactory
extends ArtifactStubFactory
{
private boolean flattenedPath = true;
private ArchiverManager archiverManager;

public DependencyArtifactStubFactory( File theWorkingDir, boolean theCreateFiles, boolean flattenedPath )
{
Expand Down Expand Up @@ -95,4 +101,37 @@ public Artifact createArtifact( String groupId, String artifactId, VersionRange

return artifact;
}


@Override
public void setUnpackableFile( ArchiverManager archiverManager )
{
// it is needed in createUnpackableFile method
this.archiverManager = archiverManager;
super.setUnpackableFile( archiverManager );
}

/**
* We need override original method which try to set wrong class of logger on Archiver.
* <p>
* Newer version of Archiver use SLF4J instead of Plexus logger.
*/
@Override
public void createUnpackableFile( Artifact artifact, File destFile )
throws NoSuchArchiverException, ArchiverException, IOException
{
Archiver archiver = archiverManager.getArchiver( destFile );

archiver.setDestFile( destFile );
archiver.addFile( getSrcFile(), getUnpackableFileName( artifact ) );

if ( archiver instanceof WarArchiver )
{
WarArchiver war = (WarArchiver) archiver;
// the use of this is counter-intuitive:
// http://jira.codehaus.org/browse/PLX-286
war.setIgnoreWebxml( false );
}
archiver.createArchive();
}
}