From 11f65a9cb772137f2a165ed3f6952d928acdd6ff Mon Sep 17 00:00:00 2001 From: Jean-Francois Denise Date: Tue, 28 Mar 2023 17:16:02 +0200 Subject: [PATCH] Fix for WFMP-198, Cleanup maven dependencies --- plugin/pom.xml | 41 +++++- .../org/wildfly/plugin/common/Archives.java | 133 ------------------ pom.xml | 91 ++++++++---- tests/standalone-tests/pom.xml | 29 +++- 4 files changed, 126 insertions(+), 168 deletions(-) delete mode 100644 plugin/src/main/java/org/wildfly/plugin/common/Archives.java diff --git a/plugin/pom.xml b/plugin/pom.xml index 10457179..a118c177 100644 --- a/plugin/pom.xml +++ b/plugin/pom.xml @@ -122,19 +122,18 @@ javax.inject javax.inject + provided - - org.apache.commons - commons-compress - org.apache.maven maven-core + provided org.apache.maven maven-plugin-api + provided @@ -145,8 +144,32 @@ true - org.eclipse.aether - aether-api + org.apache.maven.resolver + maven-resolver-api + + + org.apache.maven.resolver + maven-resolver-spi + + + org.apache.maven.resolver + maven-resolver-impl + + + org.apache.maven.resolver + maven-resolver-connector-basic + + + org.apache.maven.resolver + maven-resolver-transport-http + + + org.apache.maven.resolver + maven-resolver-util + + + org.apache.maven.resolver + maven-resolver-named-locks org.jboss.galleon @@ -161,6 +184,12 @@ org.twdata.maven mojo-executor ${version.org.twdata.maven} + + + * + * + + org.wildfly.core diff --git a/plugin/src/main/java/org/wildfly/plugin/common/Archives.java b/plugin/src/main/java/org/wildfly/plugin/common/Archives.java deleted file mode 100644 index 4066fb91..00000000 --- a/plugin/src/main/java/org/wildfly/plugin/common/Archives.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2018, Red Hat, Inc., and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.wildfly.plugin.common; - -import java.io.BufferedInputStream; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardCopyOption; -import java.util.Locale; - -import org.apache.commons.compress.archivers.ArchiveEntry; -import org.apache.commons.compress.archivers.ArchiveException; -import org.apache.commons.compress.archivers.ArchiveInputStream; -import org.apache.commons.compress.archivers.ArchiveStreamFactory; -import org.apache.commons.compress.compressors.CompressorException; -import org.apache.commons.compress.compressors.CompressorInputStream; -import org.apache.commons.compress.compressors.CompressorStreamFactory; - -/** - * @author James R. Perkins - */ -public class Archives { - - /** - * Unzips the zip file to the target directory. - *

- * Note this is specific to how WildFly is archived. The first directory is assumed to be the base home directory - * and will returned. - *

- * - * @param archiveFile the archive to uncompress, can be a {@code .zip} or {@code .tar.gz} - * @param targetDir the directory to extract the zip file to - * - * @return the path to the extracted directory - * - * @throws java.io.IOException if an I/O error occurs - */ - public static Path uncompress(final Path archiveFile, final Path targetDir) throws IOException { - return uncompress(archiveFile, targetDir, false); - } - - /** - * Unzips the zip file to the target directory. - *

- * Note this is specific to how WildFly is archived. The first directory is assumed to be the base home directory - * and will returned. - *

- * - * @param archiveFile the archive to uncompress, can be a {@code .zip} or {@code .tar.gz} - * @param targetDir the directory to extract the zip file to - * @param replaceIfExists if {@code true} replace the existing files if they exist - * - * @return the path to the extracted directory - * - * @throws java.io.IOException if an I/O error occurs - */ - @SuppressWarnings("WeakerAccess") - public static Path uncompress(final Path archiveFile, final Path targetDir, final boolean replaceIfExists) throws IOException { - final Path archive = getArchive(archiveFile); - - Path firstDir = null; - - try (ArchiveInputStream in = new ArchiveStreamFactory().createArchiveInputStream(new BufferedInputStream(Files.newInputStream(archive)))) { - ArchiveEntry entry; - while ((entry = in.getNextEntry()) != null) { - final Path extractTarget = targetDir.resolve(entry.getName()); - if (!replaceIfExists && Files.exists(extractTarget)) { - if (entry.isDirectory() && firstDir == null) { - firstDir = extractTarget; - } - continue; - } - if (entry.isDirectory()) { - final Path dir = Files.createDirectories(extractTarget); - if (firstDir == null) { - firstDir = dir; - } - } else { - Files.createDirectories(extractTarget.getParent()); - Files.copy(in, extractTarget); - } - } - return firstDir == null ? targetDir : firstDir; - } catch (ArchiveException e) { - throw new IOException(e); - } - } - - private static Path getArchive(final Path path) throws IOException { - final Path result; - // Get the extension - final String fileName = path.getFileName().toString(); - final String loweredFileName = fileName.toLowerCase(Locale.ENGLISH); - if (loweredFileName.endsWith(".gz")) { - String tempFileName = fileName.substring(0, loweredFileName.indexOf(".gz")); - final int index = tempFileName.lastIndexOf('.'); - if (index > 0) { - result = Files.createTempFile(tempFileName.substring(0, index), tempFileName.substring(index)); - } else { - result = Files.createTempFile(tempFileName.substring(0, index), ""); - } - try (CompressorInputStream in = new CompressorStreamFactory().createCompressorInputStream(new BufferedInputStream(Files.newInputStream(path)))) { - Files.copy(in, result, StandardCopyOption.REPLACE_EXISTING); - } catch (CompressorException e) { - throw new IOException(e); - } - } else { - result = path; - } - return result; - } -} diff --git a/pom.xml b/pom.xml index 3805350f..91a589c0 100644 --- a/pom.xml +++ b/pom.xml @@ -100,19 +100,18 @@ 1.0.0.Beta7 1 - 3.3.9 + 3.6.2 3.3.0 3.7.0 0.9.1 - 1.1.0 + 1.9.6 0.3.5 2.3.1 2.3.2 4.13.2 - 1.22 5.2.0 @@ -125,7 +124,6 @@ true 1.2.1.Final - 1.1.0 false @@ -164,7 +162,11 @@ sisu-maven-plugin ${version.org.eclipse.sisu} - + + org.apache.maven.plugins + maven-plugin-plugin + ${version.org.apache.maven.maven-core} + maven-surefire-plugin @@ -238,11 +240,6 @@ ${version.javax.inject.javax.inject}
- - org.apache.commons - commons-compress - ${version.org.apache.commons.compress} - org.apache.maven maven-core @@ -271,14 +268,50 @@ ${version.org.apache.maven.plugin-tools} - org.eclipse.aether - aether-api - ${version.org.eclipse.aether} + org.apache.maven.resolver + maven-resolver-api + ${version.org.apache.maven.resolver} + + + org.apache.maven.resolver + maven-resolver-spi + ${version.org.apache.maven.resolver} + + + org.apache.maven.resolver + maven-resolver-impl + ${version.org.apache.maven.resolver} + + + org.apache.maven.resolver + maven-resolver-connector-basic + ${version.org.apache.maven.resolver} + + + org.apache.maven.resolver + maven-resolver-transport-http + ${version.org.apache.maven.resolver} + + + org.apache.maven.resolver + maven-resolver-util + ${version.org.apache.maven.resolver} + + + org.apache.maven.resolver + maven-resolver-named-locks + ${version.org.apache.maven.resolver} org.jboss.galleon galleon-maven-plugin ${version.org.jboss.galleon} + + + * + * + + org.jboss.galleon @@ -289,6 +322,24 @@ org.jboss.galleon galleon-maven-universe ${version.org.jboss.galleon} + + + org.apache.maven.shared + maven-artifact-transfer + + + org.apache.maven + maven-artifact + + + org.eclipse.aether + aether-api + + + org.eclipse.aether + aether-util + + org.jboss.logging @@ -361,8 +412,8 @@ ${version.org.wildfly.prospero} - org.wildfly.channel - channel-core + * + * @@ -398,16 +449,6 @@ mockito-core ${version.org.mockito.mockito} - - org.eclipse.aether - aether-connector-basic - ${version.org.eclipse.aether} - - - org.eclipse.aether - aether-transport-http - ${version.org.eclipse.aether} - org.jboss.slf4j slf4j-jboss-logging diff --git a/tests/standalone-tests/pom.xml b/tests/standalone-tests/pom.xml index effd1ccf..0f90c153 100644 --- a/tests/standalone-tests/pom.xml +++ b/tests/standalone-tests/pom.xml @@ -59,15 +59,36 @@ test - org.eclipse.aether - aether-connector-basic + org.apache.maven.resolver + maven-resolver-api test - org.eclipse.aether - aether-transport-http + org.apache.maven.resolver + maven-resolver-spi test + + org.apache.maven.resolver + maven-resolver-impl + test + + + org.apache.maven.resolver + maven-resolver-connector-basic + test + + + org.apache.maven.resolver + maven-resolver-transport-http + test + + + org.apache.maven.resolver + maven-resolver-util + test + + org.jboss.slf4j