Skip to content

Commit 95aca1f

Browse files
Bump org.codehaus.plexus:plexus-archiver from 4.2.7 to 4.11.0 (#2224)
* Bump org.codehaus.plexus:plexus-archiver from 4.2.7 to 4.11.0 Bumps [org.codehaus.plexus:plexus-archiver](https://github.com/codehaus-plexus/plexus-archiver) from 4.2.7 to 4.11.0. - [Release notes](https://github.com/codehaus-plexus/plexus-archiver/releases) - [Changelog](https://github.com/codehaus-plexus/plexus-archiver/blob/master/ReleaseNotes.md) - [Commits](codehaus-plexus/plexus-archiver@plexus-archiver-4.2.7...plexus-archiver-4.11.0) --- updated-dependencies: - dependency-name: org.codehaus.plexus:plexus-archiver dependency-version: 4.11.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Fix the way to deal with temp files in the KarMojo --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JB Onofré <jb.onofre@dremio.com>
1 parent edbd9df commit 95aca1f

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

tooling/karaf-maven-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
<dependency>
170170
<groupId>org.codehaus.plexus</groupId>
171171
<artifactId>plexus-archiver</artifactId>
172-
<version>4.2.7</version>
172+
<version>4.11.0</version>
173173
</dependency>
174174
<dependency>
175175
<groupId>org.apache.felix</groupId>

tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/KarMojo.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@
5050
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
5151
import org.apache.maven.plugin.MojoExecutionException;
5252
import org.apache.maven.plugin.MojoFailureException;
53-
import org.apache.maven.plugins.annotations.Component;
5453
import org.apache.maven.plugins.annotations.LifecyclePhase;
5554
import org.apache.maven.plugins.annotations.Mojo;
5655
import org.apache.maven.plugins.annotations.Parameter;
5756
import org.apache.maven.plugins.annotations.ResolutionScope;
58-
import org.codehaus.plexus.archiver.Archiver;
5957
import org.codehaus.plexus.archiver.jar.JarArchiver;
58+
import javax.inject.Inject;
59+
import javax.inject.Named;
6060

6161
/**
6262
* Assemble a kar archive from a features.xml file
@@ -75,7 +75,8 @@ public class KarMojo extends MojoSupport {
7575
/**
7676
* The Jar archiver.
7777
*/
78-
@Component(role = Archiver.class, hint="jar")
78+
@Inject
79+
@Named("jar")
7980
private JarArchiver jarArchiver = null;
8081

8182
/**
@@ -264,6 +265,7 @@ private File createArchive(List<Artifact> bundles, File featuresFile, String gro
264265
// configure for Reproducible Builds based on outputTimestamp value
265266
archiver.configureReproducible(outputTimestamp);
266267

268+
List<File> tempMetadataFiles = new ArrayList<>();
267269
try {
268270
//TODO should .kar be a bundle?
269271
// archive.addManifestEntry(Constants.BUNDLE_NAME, project.getName());
@@ -345,12 +347,7 @@ private File createArchive(List<Artifact> bundles, File featuresFile, String gro
345347
}
346348

347349
jarArchiver.addFile(metadataTmp, repositoryPath + layout.pathOf(artifact).substring(0, layout.pathOf(artifact).lastIndexOf('/')) + "/maven-metadata-local.xml");
348-
349-
try {
350-
metadataTmp.delete();
351-
} catch (final Exception ex) {
352-
getLog().warn("Cannot delete temporary created file.", ex);
353-
}
350+
tempMetadataFiles.add(metadataTmp);
354351
}
355352

356353
String targetFileName = repositoryPath + layout.pathOf(artifact);
@@ -362,6 +359,16 @@ private File createArchive(List<Artifact> bundles, File featuresFile, String gro
362359
}
363360
archiver.createArchive(mavenSession, project, archive);
364361

362+
for (File tempMetadataFile : tempMetadataFiles) {
363+
try {
364+
if (!tempMetadataFile.delete()) {
365+
getLog().warn("Cannot delete temporary created file: " + tempMetadataFile.getAbsolutePath());
366+
}
367+
} catch (final Exception ex) {
368+
getLog().warn("Cannot delete temporary created file: " + tempMetadataFile.getAbsolutePath(), ex);
369+
}
370+
}
371+
365372
return archiveFile;
366373
} catch (Exception e) {
367374
throw new MojoExecutionException("Failed to create archive", e);

0 commit comments

Comments
 (0)