From 92abe638e90561991fa681c983807e711858fdae Mon Sep 17 00:00:00 2001 From: Sven Kubiak Date: Mon, 23 Aug 2021 09:59:50 +0200 Subject: [PATCH] #504 Removed slim JAR deployed --- mangooio-dependencies/pom.xml | 105 ------------------ .../src/main/java/io/mangoo/Dependencies.java | 89 --------------- pom.xml | 1 - 3 files changed, 195 deletions(-) delete mode 100644 mangooio-dependencies/pom.xml delete mode 100644 mangooio-dependencies/src/main/java/io/mangoo/Dependencies.java diff --git a/mangooio-dependencies/pom.xml b/mangooio-dependencies/pom.xml deleted file mode 100644 index b855260400..0000000000 --- a/mangooio-dependencies/pom.xml +++ /dev/null @@ -1,105 +0,0 @@ - - 4.0.0 - - io.mangoo - mangooio - 6.12.1-SNAPSHOT - - mangooio-dependencies - jar - - - - org.apache.maven.plugins - maven-shade-plugin - - - package - - shade - - - - - - - - - io.mangoo.Dependencies - - true - - - - false - true - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - dependencies - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - - - - false - - - - - - enforce - - enforce - - validate - - - enforce-maven - - enforce - - - - - ${required.maven.version} - - - - - - enforce-ban-circular-dependencies - - enforce - - - - - - true - - - - - - org.codehaus.mojo - extra-enforcer-rules - ${enforcer.version} - - - - - - diff --git a/mangooio-dependencies/src/main/java/io/mangoo/Dependencies.java b/mangooio-dependencies/src/main/java/io/mangoo/Dependencies.java deleted file mode 100644 index 5e3fafc027..0000000000 --- a/mangooio-dependencies/src/main/java/io/mangoo/Dependencies.java +++ /dev/null @@ -1,89 +0,0 @@ -package io.mangoo; - -import java.io.IOException; -import java.io.InputStream; -import java.math.BigInteger; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.Map.Entry; -import java.util.Properties; -import java.util.stream.Stream; - -@SuppressWarnings("all") -public class Dependencies { - private static final String REPO = "https://repo.maven.apache.org/maven2/"; - private static final String WORKDIR = System.getProperty("user.dir"); - private static final String DEPENDENCIES_FILE = WORKDIR + "/dependencies.properties"; - private static final String LIB_FOLDER = WORKDIR + "/lib/"; - - public static void main(String[] args) { - Properties properties = new Properties(); - try (InputStream inputStream = Files.newInputStream(Paths.get(DEPENDENCIES_FILE))) { //NOSONAR - properties.load(inputStream); - } catch (IOException e) { - e.printStackTrace(); //NOSONAR - } - - for (Entry entry : properties.entrySet()) { - String dependency = (String) entry.getValue(); - String[] parts = dependency.split(":"); - - String groupId = parts[0].replace('.', '/'); - String artifact = parts[1]; - String version = parts [2]; - String jar = artifact + "-" + version + ".jar"; - - String url = REPO + groupId + "/" + artifact + "/" + version + "/" + jar; - String hash = hash256(groupId + artifact); - - Path file = Paths.get(LIB_FOLDER + hash + "-" + version + "-" + jar); //NOSONAR - if (!Files.exists(file)) { - deletePreviousVersion(hash, version); - - try (InputStream inputstream = new URL(url).openStream()) { //NOSONAR - Files.copy(inputstream, Paths.get(LIB_FOLDER + hash + "-" + version + "-" + jar), StandardCopyOption.REPLACE_EXISTING); //NOSONAR - } catch (IOException e) { - e.printStackTrace(); //NOSONAR - } - } - } - } - - private static void deletePreviousVersion(String hash, String version) { - try (Stream stream = Files.list(Paths.get(LIB_FOLDER))) { //NOSONAR - stream.filter(path -> path.toFile().getName().startsWith(hash) && !path.toFile().getName().startsWith(hash + "-" + version)) - .forEach(c -> { - try { - Files.delete(c); - } catch (IOException e) { - e.printStackTrace(); //NOSONAR - } - }); - } catch (IOException e) { - e.printStackTrace(); //NOSONAR - } - } - - private static String hash256(String input) { - String hash = ""; - try { - MessageDigest md = MessageDigest.getInstance("SHA-256"); - byte[] messageDigest = md.digest(input.getBytes(StandardCharsets.UTF_8)); - BigInteger no = new BigInteger(1, messageDigest); - hash = no.toString(16); - while (hash.length() < 32) { - hash = "0" + hash; - } - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); //NOSONAR - } - - return hash; - } -} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 375526bcb4..f4f75bcd82 100644 --- a/pom.xml +++ b/pom.xml @@ -40,7 +40,6 @@ mangooio-integration-test mangooio-test mangooio-maven-plugin - mangooio-dependencies scm:git:git@github.com:svenkubiak/mangooio.git