From 6d082c1bac42a43acbf72a75c1a66d813aba2e7a Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Fri, 15 Sep 2023 04:54:54 -0700 Subject: [PATCH 01/15] Removed unused imports --- .../java/rife/bld/blueprints/BaseProjectBlueprint.java | 1 - src/main/java/rife/bld/operations/CleanOperation.java | 1 - src/main/java/rife/bld/operations/CompileOperation.java | 1 - src/main/java/rife/bld/operations/CreateLibOperation.java | 1 - src/main/java/rife/bld/operations/JarOperation.java | 1 - src/main/java/rife/bld/operations/JavaOptions.java | 1 - src/main/java/rife/bld/operations/JavadocOperation.java | 1 - src/main/java/rife/bld/operations/TestOperation.java | 2 -- src/main/java/rife/bld/operations/UberJarOperation.java | 1 - src/main/java/rife/bld/operations/UpdatesOperation.java | 1 - .../java/rife/bld/operations/exceptions/SignException.java | 2 -- src/test/java/rife/bld/TestProject.java | 1 - .../java/rife/bld/operations/TestCreateBaseOperation.java | 7 ------- .../java/rife/bld/operations/TestCreateLibOperation.java | 5 ----- 14 files changed, 26 deletions(-) diff --git a/src/main/java/rife/bld/blueprints/BaseProjectBlueprint.java b/src/main/java/rife/bld/blueprints/BaseProjectBlueprint.java index 6a299f4..440cb11 100644 --- a/src/main/java/rife/bld/blueprints/BaseProjectBlueprint.java +++ b/src/main/java/rife/bld/blueprints/BaseProjectBlueprint.java @@ -13,7 +13,6 @@ import static rife.bld.dependencies.Repository.MAVEN_CENTRAL; import static rife.bld.dependencies.Repository.SONATYPE_SNAPSHOTS; -import static rife.bld.dependencies.Scope.test; /** * Provides the dependency information required to create a new base project. diff --git a/src/main/java/rife/bld/operations/CleanOperation.java b/src/main/java/rife/bld/operations/CleanOperation.java index b29223e..e4a07ae 100644 --- a/src/main/java/rife/bld/operations/CleanOperation.java +++ b/src/main/java/rife/bld/operations/CleanOperation.java @@ -5,7 +5,6 @@ package rife.bld.operations; import rife.bld.BaseProject; -import rife.bld.Project; import rife.tools.FileUtils; import rife.tools.exceptions.FileUtilsErrorException; diff --git a/src/main/java/rife/bld/operations/CompileOperation.java b/src/main/java/rife/bld/operations/CompileOperation.java index 9eefed3..6805926 100644 --- a/src/main/java/rife/bld/operations/CompileOperation.java +++ b/src/main/java/rife/bld/operations/CompileOperation.java @@ -5,7 +5,6 @@ package rife.bld.operations; import rife.bld.BaseProject; -import rife.bld.Project; import rife.bld.operations.exceptions.ExitStatusException; import rife.tools.FileUtils; diff --git a/src/main/java/rife/bld/operations/CreateLibOperation.java b/src/main/java/rife/bld/operations/CreateLibOperation.java index 91516f7..c4df0f1 100644 --- a/src/main/java/rife/bld/operations/CreateLibOperation.java +++ b/src/main/java/rife/bld/operations/CreateLibOperation.java @@ -5,7 +5,6 @@ package rife.bld.operations; import rife.bld.Project; -import rife.bld.blueprints.BaseProjectBlueprint; import rife.bld.blueprints.LibProjectBlueprint; import java.io.File; diff --git a/src/main/java/rife/bld/operations/JarOperation.java b/src/main/java/rife/bld/operations/JarOperation.java index b04ae9d..af29057 100644 --- a/src/main/java/rife/bld/operations/JarOperation.java +++ b/src/main/java/rife/bld/operations/JarOperation.java @@ -6,7 +6,6 @@ import rife.bld.BaseProject; import rife.bld.NamedFile; -import rife.bld.Project; import rife.tools.FileUtils; import rife.tools.StringUtils; diff --git a/src/main/java/rife/bld/operations/JavaOptions.java b/src/main/java/rife/bld/operations/JavaOptions.java index 4d553b8..5e4ab59 100644 --- a/src/main/java/rife/bld/operations/JavaOptions.java +++ b/src/main/java/rife/bld/operations/JavaOptions.java @@ -8,7 +8,6 @@ import java.io.File; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; /** diff --git a/src/main/java/rife/bld/operations/JavadocOperation.java b/src/main/java/rife/bld/operations/JavadocOperation.java index 12cad14..29573ca 100644 --- a/src/main/java/rife/bld/operations/JavadocOperation.java +++ b/src/main/java/rife/bld/operations/JavadocOperation.java @@ -5,7 +5,6 @@ package rife.bld.operations; import rife.bld.BaseProject; -import rife.bld.Project; import rife.bld.operations.exceptions.ExitStatusException; import rife.tools.FileUtils; import rife.tools.StringUtils; diff --git a/src/main/java/rife/bld/operations/TestOperation.java b/src/main/java/rife/bld/operations/TestOperation.java index 3002253..184e8ba 100644 --- a/src/main/java/rife/bld/operations/TestOperation.java +++ b/src/main/java/rife/bld/operations/TestOperation.java @@ -5,12 +5,10 @@ package rife.bld.operations; import rife.bld.BaseProject; -import rife.bld.Project; import rife.tools.FileUtils; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * Tests a Java application. diff --git a/src/main/java/rife/bld/operations/UberJarOperation.java b/src/main/java/rife/bld/operations/UberJarOperation.java index 24bb303..ee5f20a 100644 --- a/src/main/java/rife/bld/operations/UberJarOperation.java +++ b/src/main/java/rife/bld/operations/UberJarOperation.java @@ -6,7 +6,6 @@ import rife.bld.BaseProject; import rife.bld.NamedFile; -import rife.bld.Project; import rife.tools.FileUtils; import rife.tools.exceptions.FileUtilsErrorException; diff --git a/src/main/java/rife/bld/operations/UpdatesOperation.java b/src/main/java/rife/bld/operations/UpdatesOperation.java index 16395df..c03aa0f 100644 --- a/src/main/java/rife/bld/operations/UpdatesOperation.java +++ b/src/main/java/rife/bld/operations/UpdatesOperation.java @@ -5,7 +5,6 @@ package rife.bld.operations; import rife.bld.BaseProject; -import rife.bld.Project; import rife.bld.dependencies.*; import java.util.ArrayList; diff --git a/src/main/java/rife/bld/operations/exceptions/SignException.java b/src/main/java/rife/bld/operations/exceptions/SignException.java index 1140b61..eab071d 100644 --- a/src/main/java/rife/bld/operations/exceptions/SignException.java +++ b/src/main/java/rife/bld/operations/exceptions/SignException.java @@ -4,8 +4,6 @@ */ package rife.bld.operations.exceptions; -import rife.tools.HttpUtils; - import java.io.File; import java.io.Serial; diff --git a/src/test/java/rife/bld/TestProject.java b/src/test/java/rife/bld/TestProject.java index cd4401c..d432a9d 100644 --- a/src/test/java/rife/bld/TestProject.java +++ b/src/test/java/rife/bld/TestProject.java @@ -11,7 +11,6 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.io.PrintStream; -import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.util.List; diff --git a/src/test/java/rife/bld/operations/TestCreateBaseOperation.java b/src/test/java/rife/bld/operations/TestCreateBaseOperation.java index ee8ed6f..79edde2 100644 --- a/src/test/java/rife/bld/operations/TestCreateBaseOperation.java +++ b/src/test/java/rife/bld/operations/TestCreateBaseOperation.java @@ -5,16 +5,9 @@ package rife.bld.operations; import org.junit.jupiter.api.Test; -import rife.bld.dependencies.LocalDependency; -import rife.bld.dependencies.Scope; -import rife.bld.operations.exceptions.ExitStatusException; import rife.tools.FileUtils; -import javax.tools.DiagnosticCollector; -import javax.tools.JavaFileObject; -import java.io.File; import java.nio.file.Files; -import java.nio.file.Path; import java.util.regex.Pattern; import static org.junit.jupiter.api.Assertions.*; diff --git a/src/test/java/rife/bld/operations/TestCreateLibOperation.java b/src/test/java/rife/bld/operations/TestCreateLibOperation.java index c54c09b..7cfb736 100644 --- a/src/test/java/rife/bld/operations/TestCreateLibOperation.java +++ b/src/test/java/rife/bld/operations/TestCreateLibOperation.java @@ -5,14 +5,9 @@ package rife.bld.operations; import org.junit.jupiter.api.Test; -import rife.bld.dependencies.LocalDependency; -import rife.bld.dependencies.Scope; import rife.tools.FileUtils; -import java.io.File; import java.nio.file.Files; -import java.nio.file.Path; -import java.util.regex.Pattern; import static org.junit.jupiter.api.Assertions.*; From e69f4fe554dc78b009d98e3c52f136d62bd6c247 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Fri, 15 Sep 2023 05:02:50 -0700 Subject: [PATCH 02/15] Migrated syntax to Java 8+ --- src/bld/java/rife/BldBuild.java | 6 ++--- .../bld/dependencies/Xml2MavenMetadata.java | 27 +++++++++---------- .../operations/AbstractCreateOperation.java | 4 +-- .../rife/bld/operations/CreateOperation.java | 6 ++--- .../rife/bld/operations/JarOperation.java | 1 + 5 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/bld/java/rife/BldBuild.java b/src/bld/java/rife/BldBuild.java index 8626a87..a6550ce 100644 --- a/src/bld/java/rife/BldBuild.java +++ b/src/bld/java/rife/BldBuild.java @@ -132,11 +132,9 @@ public void zipBld() f.perms(0755); }); }); - b.dir("lib", l -> { - l.file("bld-wrapper.jar", f -> f.move(path(tmp, "lib", "bld", "bld-wrapper.jar"))); - }); + b.dir("lib", l -> l.file("bld-wrapper.jar", f -> f.move(path(tmp, "lib", "bld", "bld-wrapper.jar")))); }); - t.dir("lib", l -> l.delete()); + t.dir("lib", DirBuilder::delete); }); zipBldOperation diff --git a/src/main/java/rife/bld/dependencies/Xml2MavenMetadata.java b/src/main/java/rife/bld/dependencies/Xml2MavenMetadata.java index 51ad0b7..3a21b0c 100644 --- a/src/main/java/rife/bld/dependencies/Xml2MavenMetadata.java +++ b/src/main/java/rife/bld/dependencies/Xml2MavenMetadata.java @@ -89,20 +89,19 @@ public void endElement(String uri, String localName, String qName) { public void endDocument() throws SAXException { // determine latest stable version by removing pre-release qualifiers - var filtered_versions = new TreeSet(); - filtered_versions.addAll(versions_.stream() - .filter(v -> { - if (v.qualifier() == null) return true; - var q = v.qualifier().toLowerCase(); - return !q.startsWith("rc") && - !q.startsWith("cr") && - !q.contains("milestone") && - !MILESTONE.matcher(q).matches() && - !q.contains("beta") && - !BETA.matcher(q).matches() && - !q.contains("alpha") && - !ALPHA.matcher(q).matches(); - }).toList()); + var filtered_versions = new TreeSet<>(versions_.stream() + .filter(v -> { + if (v.qualifier() == null) return true; + var q = v.qualifier().toLowerCase(); + return !q.startsWith("rc") && + !q.startsWith("cr") && + !q.contains("milestone") && + !MILESTONE.matcher(q).matches() && + !q.contains("beta") && + !BETA.matcher(q).matches() && + !q.contains("alpha") && + !ALPHA.matcher(q).matches(); + }).toList()); // only replace the stable version from the metadata when // something remained from the filtering, then use the diff --git a/src/main/java/rife/bld/operations/AbstractCreateOperation.java b/src/main/java/rife/bld/operations/AbstractCreateOperation.java index dd0a0a8..ec5a23d 100644 --- a/src/main/java/rife/bld/operations/AbstractCreateOperation.java +++ b/src/main/java/rife/bld/operations/AbstractCreateOperation.java @@ -364,10 +364,10 @@ protected void executeDownloadDependencies() { public T fromArguments(List arguments) { String package_name = null; String project_name = null; - if (arguments.size() > 0) { + if (!arguments.isEmpty()) { package_name = arguments.remove(0); } - if (arguments.size() > 0) { + if (!arguments.isEmpty()) { project_name = arguments.remove(0); } if ((package_name == null || project_name == null) && System.console() == null) { diff --git a/src/main/java/rife/bld/operations/CreateOperation.java b/src/main/java/rife/bld/operations/CreateOperation.java index 066cf57..9a64ffe 100644 --- a/src/main/java/rife/bld/operations/CreateOperation.java +++ b/src/main/java/rife/bld/operations/CreateOperation.java @@ -27,13 +27,13 @@ public class CreateOperation { String type = null; String package_name = null; String project_name = null; - if (arguments.size() > 0) { + if (!arguments.isEmpty()) { type = arguments.remove(0); } - if (arguments.size() > 0) { + if (!arguments.isEmpty()) { package_name = arguments.remove(0); } - if (arguments.size() > 0) { + if (!arguments.isEmpty()) { project_name = arguments.remove(0); } if ((type == null || package_name == null || project_name == null) && System.console() == null) { diff --git a/src/main/java/rife/bld/operations/JarOperation.java b/src/main/java/rife/bld/operations/JarOperation.java index af29057..9e8e869 100644 --- a/src/main/java/rife/bld/operations/JarOperation.java +++ b/src/main/java/rife/bld/operations/JarOperation.java @@ -94,6 +94,7 @@ protected Manifest executeCreateManifest() { // don't use putAll since Attributes does an instanceof check // on the map being passed in, causing it to fail if it's not // and instance of Attributes + //noinspection UseBulkOperation attributes.put(entry.getKey(), entry.getValue()); // ^^^ READ above, don't use putAll } From 762a63b12fb5a316806a00467cf16733a22b7723 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Fri, 15 Sep 2023 05:19:51 -0700 Subject: [PATCH 03/15] Flipped String equals to avoid potential null pointer exception --- src/main/java/rife/bld/dependencies/Dependency.java | 2 +- .../java/rife/bld/dependencies/DependencyExclusion.java | 8 ++++---- src/main/java/rife/bld/dependencies/Xml2MavenPom.java | 8 ++++---- src/main/java/rife/bld/operations/JUnitOperation.java | 6 +++--- src/main/java/rife/bld/publish/PomBuilder.java | 2 +- src/main/java/rife/bld/wrapper/Wrapper.java | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/rife/bld/dependencies/Dependency.java b/src/main/java/rife/bld/dependencies/Dependency.java index 48fbe0f..8939c18 100644 --- a/src/main/java/rife/bld/dependencies/Dependency.java +++ b/src/main/java/rife/bld/dependencies/Dependency.java @@ -147,7 +147,7 @@ public String toString() { if (!classifier.isEmpty()) { result.append(":").append(classifier); } - if (!type.isEmpty() && !type.equals("jar")) { + if (!type.isEmpty() && !"jar".equals(type)) { result.append("@").append(type); } return result.toString(); diff --git a/src/main/java/rife/bld/dependencies/DependencyExclusion.java b/src/main/java/rife/bld/dependencies/DependencyExclusion.java index 23bb3b3..f9a7d7e 100644 --- a/src/main/java/rife/bld/dependencies/DependencyExclusion.java +++ b/src/main/java/rife/bld/dependencies/DependencyExclusion.java @@ -25,10 +25,10 @@ public int hashCode() { } boolean matches(PomDependency dependency) { - return (groupId().equals("*") && artifactId().equals("*")) || - (groupId().equals("*") && artifactId().equals(dependency.artifactId())) || - (groupId().equals(dependency.groupId()) && artifactId().equals("*")) || - (groupId().equals(dependency.groupId()) && artifactId().equals(dependency.artifactId())); + return ("*".equals(groupId()) && "*".equals(artifactId())) || + ("*".equals(groupId()) && artifactId().equals(dependency.artifactId())) || + (groupId().equals(dependency.groupId()) && "*".equals(artifactId())) || + (groupId().equals(dependency.groupId()) && dependency.artifactId().equals(artifactId())); } } diff --git a/src/main/java/rife/bld/dependencies/Xml2MavenPom.java b/src/main/java/rife/bld/dependencies/Xml2MavenPom.java index fd3e46e..03d5c82 100644 --- a/src/main/java/rife/bld/dependencies/Xml2MavenPom.java +++ b/src/main/java/rife/bld/dependencies/Xml2MavenPom.java @@ -287,19 +287,19 @@ public void endElement(String uri, String localName, String qName) { } private boolean isChildOfProject() { - return elementStack_.peek().equals("project"); + return "project".equals(elementStack_.peek()); } private boolean isChildOfParent() { - return elementStack_.peek().equals("parent"); + return "parent".equals(elementStack_.peek()); } private boolean isChildOfDependency() { - return elementStack_.peek().equals("dependency"); + return "dependency".equals(elementStack_.peek()); } private boolean isChildOfExclusion() { - return elementStack_.peek().equals("exclusion"); + return "exclusion".equals(elementStack_.peek()); } private void addProjectProperty(String name) { diff --git a/src/main/java/rife/bld/operations/JUnitOperation.java b/src/main/java/rife/bld/operations/JUnitOperation.java index f79a6f3..c13b3f0 100644 --- a/src/main/java/rife/bld/operations/JUnitOperation.java +++ b/src/main/java/rife/bld/operations/JUnitOperation.java @@ -34,7 +34,7 @@ public JUnitOperation fromProject(BaseProject project) { } // add the default JUnit options if none were specified - if (testToolOptions().isEmpty() && mainClass().equals(DEFAULT_TEST_TOOL_JUNIT5)) { + if (testToolOptions().isEmpty() && DEFAULT_TEST_TOOL_JUNIT5.equals(mainClass())) { testToolOptions().defaultOptions(); } @@ -45,9 +45,9 @@ public JUnitOperation fromProject(BaseProject project) { var argument = arguments.get(0); if (argument.startsWith("-")) { arguments.remove(0); - if (argument.equals("--junit-help")) { + if ("--junit-help".equals(argument)) { testToolOptions().add("--help"); - } else if (argument.equals("--junit-clear")) { + } else if ("--junit-clear".equals(argument)) { testToolOptions().clear(); } else { testToolOptions().add(argument); diff --git a/src/main/java/rife/bld/publish/PomBuilder.java b/src/main/java/rife/bld/publish/PomBuilder.java index 9e2540b..8df677b 100644 --- a/src/main/java/rife/bld/publish/PomBuilder.java +++ b/src/main/java/rife/bld/publish/PomBuilder.java @@ -151,7 +151,7 @@ private void addDependencies(Template t, Scope scope) { t.blankValue("dependency-type"); t.blankValue("dependency-type-tag"); - if (!dependency.type().equals("jar")) { + if (!"jar".equals(dependency.type())) { t.setValueEncoded("dependency-type", dependency.type()); t.setBlock("dependency-type-tag"); } diff --git a/src/main/java/rife/bld/wrapper/Wrapper.java b/src/main/java/rife/bld/wrapper/Wrapper.java index aa73412..19c2d1c 100644 --- a/src/main/java/rife/bld/wrapper/Wrapper.java +++ b/src/main/java/rife/bld/wrapper/Wrapper.java @@ -496,7 +496,7 @@ private void resolveExtensions() { private int launchMain(File jarFile, List arguments) throws IOException, InterruptedException, FileUtilsErrorException { - if (arguments.isEmpty() || !arguments.get(0).equals("--build")) { + if (arguments.isEmpty() || !"--build".equals(arguments.get(0))) { return launchMainCli(jarFile, arguments); } return launchMainBuild(jarFile, arguments); From 102d3d358651d4997b2d59f7d7508b304e4e8559 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Fri, 15 Sep 2023 05:44:19 -0700 Subject: [PATCH 04/15] Preserved stacktrace --- .../java/rife/bld/operations/PublishOperation.java | 4 ++-- .../bld/operations/exceptions/SignException.java | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/rife/bld/operations/PublishOperation.java b/src/main/java/rife/bld/operations/PublishOperation.java index 537c3c4..69109df 100644 --- a/src/main/java/rife/bld/operations/PublishOperation.java +++ b/src/main/java/rife/bld/operations/PublishOperation.java @@ -348,12 +348,12 @@ protected String executeSignFile(File file) try { process.waitFor(); } catch (InterruptedException e) { - throw new SignException(file, e.getMessage()); + throw new SignException(file, e); } if (process.exitValue() != 0) { var error = FileUtils.readString(process.getErrorStream()); - throw new SignException(file, error); + throw new SignException(file); } return FileUtils.readString(process.getInputStream()); } diff --git a/src/main/java/rife/bld/operations/exceptions/SignException.java b/src/main/java/rife/bld/operations/exceptions/SignException.java index eab071d..e3de0fc 100644 --- a/src/main/java/rife/bld/operations/exceptions/SignException.java +++ b/src/main/java/rife/bld/operations/exceptions/SignException.java @@ -19,10 +19,16 @@ public class SignException extends RuntimeException { private final File file_; private final String reason_; - public SignException(File file, String reason) { - super("An error occurred while signing '" + file + "':\n" + reason); + public SignException(File file) { + this(file, null); + } + + public SignException(File file, Throwable reason) { + super("An error occurred while signing '" + file, reason); file_ = file; - reason_ = reason; + if (reason.getCause() != null && reason.getCause().getMessage() != null) + reason_ = reason.getCause().getMessage(); + else reason_ = ""; } public File getFile() { From 60deb1906ab4a27cd1e256c68cca4f132143ce1d Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Fri, 15 Sep 2023 06:24:12 -0700 Subject: [PATCH 05/15] Replaced all append("x") with append('x') --- src/main/java/rife/bld/BaseProject.java | 10 +++++----- src/main/java/rife/bld/BuildExecutor.java | 2 +- src/main/java/rife/bld/dependencies/Dependency.java | 10 +++++----- .../java/rife/bld/dependencies/DependencyResolver.java | 6 +++--- src/main/java/rife/bld/dependencies/Repository.java | 8 ++++---- src/main/java/rife/bld/dependencies/VersionNumber.java | 2 +- .../java/rife/bld/operations/PublishOperation.java | 6 +++--- src/main/java/rife/bld/wrapper/Wrapper.java | 2 +- .../rife/bld/wrapper/WrapperExtensionResolver.java | 2 +- .../java/rife/bld/operations/TestJarOperation.java | 4 ++-- .../java/rife/bld/operations/TestWarOperation.java | 2 +- 11 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/main/java/rife/bld/BaseProject.java b/src/main/java/rife/bld/BaseProject.java index d379ae0..ebecc31 100644 --- a/src/main/java/rife/bld/BaseProject.java +++ b/src/main/java/rife/bld/BaseProject.java @@ -1546,22 +1546,22 @@ private String createHash() { var finger_print = new StringBuilder(); for (var repository : repositories()) { finger_print.append(repository.toString()); - finger_print.append("\n"); + finger_print.append('\n'); } for (var entry : dependencies().entrySet()) { finger_print.append(entry.getKey()); - finger_print.append("\n"); + finger_print.append('\n'); if (entry.getValue() != null) { for (var dependency : entry.getValue()) { finger_print.append(dependency.toString()); - finger_print.append("\n"); + finger_print.append('\n'); } } } finger_print.append(downloadSources()); - finger_print.append("\n"); + finger_print.append('\n'); finger_print.append(downloadJavadoc()); - finger_print.append("\n"); + finger_print.append('\n'); try { var digest = MessageDigest.getInstance("SHA-1"); diff --git a/src/main/java/rife/bld/BuildExecutor.java b/src/main/java/rife/bld/BuildExecutor.java index 6c238cf..028b578 100644 --- a/src/main/java/rife/bld/BuildExecutor.java +++ b/src/main/java/rife/bld/BuildExecutor.java @@ -399,7 +399,7 @@ public boolean executeCommand(String command) fuzzy_regexp.append(ch); fuzzy_regexp.append("\\E.*"); } - fuzzy_regexp.append("$"); + fuzzy_regexp.append('$'); var fuzzy_pattern = Pattern.compile(fuzzy_regexp.toString()); matches.addAll(buildCommands().keySet().stream() .filter(c -> fuzzy_pattern.matcher(c.toLowerCase()).matches()) diff --git a/src/main/java/rife/bld/dependencies/Dependency.java b/src/main/java/rife/bld/dependencies/Dependency.java index 8939c18..bd7f778 100644 --- a/src/main/java/rife/bld/dependencies/Dependency.java +++ b/src/main/java/rife/bld/dependencies/Dependency.java @@ -130,9 +130,9 @@ public Dependency withClassifier(String classifier) { */ public String toFileName() { var result = new StringBuilder(artifactId()); - result.append("-").append(version()); + result.append('-').append(version()); if (!classifier().isEmpty()) { - result.append("-").append(classifier()); + result.append('-').append(classifier()); } result.append(".").append(type()); return result.toString(); @@ -142,13 +142,13 @@ public String toFileName() { public String toString() { var result = new StringBuilder(groupId).append(":").append(artifactId); if (!version.equals(VersionNumber.UNKNOWN)) { - result.append(":").append(version); + result.append(':').append(version); } if (!classifier.isEmpty()) { - result.append(":").append(classifier); + result.append(':').append(classifier); } if (!type.isEmpty() && !"jar".equals(type)) { - result.append("@").append(type); + result.append('@').append(type); } return result.toString(); } diff --git a/src/main/java/rife/bld/dependencies/DependencyResolver.java b/src/main/java/rife/bld/dependencies/DependencyResolver.java index 281c857..8f61937 100644 --- a/src/main/java/rife/bld/dependencies/DependencyResolver.java +++ b/src/main/java/rife/bld/dependencies/DependencyResolver.java @@ -315,15 +315,15 @@ private List getTransferArtifacts() { return getArtifactLocations().stream().map(a -> { var result = new StringBuilder(); - result.append(version).append("/").append(dependency_.artifactId()).append("-").append(pom_version); + result.append(version).append('/').append(dependency_.artifactId()).append('-').append(pom_version); if (!dependency_.classifier().isEmpty()) { - result.append("-").append(dependency_.classifier()); + result.append('-').append(dependency_.classifier()); } var type = dependency_.type(); if (type == null) { type = "jar"; } - result.append(".").append(type); + result.append('.').append(type); return a.appendPath(result.toString()); }).toList(); diff --git a/src/main/java/rife/bld/dependencies/Repository.java b/src/main/java/rife/bld/dependencies/Repository.java index cdff56f..27641f7 100644 --- a/src/main/java/rife/bld/dependencies/Repository.java +++ b/src/main/java/rife/bld/dependencies/Repository.java @@ -159,9 +159,9 @@ public String getArtifactLocation(String groupId, String artifactId) { result.append(location()); } if (!location().endsWith("/")) { - result.append("/"); + result.append('/'); } - return result.append(group_path).append("/").append(artifactId).append("/").toString(); + return result.append(group_path).append('/').append(artifactId).append('/').toString(); } /** @@ -181,11 +181,11 @@ public String getMetadataName() { public String toString() { var result = new StringBuilder(location); if (username() != null) { - result.append(":"); + result.append(':'); try { result.append(StringEncryptor.MD5HLO.performEncryption(username(), null)); if (password() != null) { - result.append(":"); + result.append(':'); result.append(StringEncryptor.MD5HLO.performEncryption(password(), null)); } } catch (NoSuchAlgorithmException e) { diff --git a/src/main/java/rife/bld/dependencies/VersionNumber.java b/src/main/java/rife/bld/dependencies/VersionNumber.java index 650d70b..e6b245e 100644 --- a/src/main/java/rife/bld/dependencies/VersionNumber.java +++ b/src/main/java/rife/bld/dependencies/VersionNumber.java @@ -223,7 +223,7 @@ public String toString() { version.append(minorInt()); } if (revision != null) { - version.append("."); + version.append('.'); version.append(revisionInt()); } if (qualifier != null && !qualifier.isEmpty()) { diff --git a/src/main/java/rife/bld/operations/PublishOperation.java b/src/main/java/rife/bld/operations/PublishOperation.java index 69109df..7fb0a9d 100644 --- a/src/main/java/rife/bld/operations/PublishOperation.java +++ b/src/main/java/rife/bld/operations/PublishOperation.java @@ -165,15 +165,15 @@ protected VersionNumber executePublishSnapshotMetadata(Repository repository, Zo protected void executePublishArtifacts(Repository repository, VersionNumber actualVersion) { // upload artifacts for (var artifact : artifacts()) { - var artifact_name = new StringBuilder(info().artifactId()).append("-").append(actualVersion); + var artifact_name = new StringBuilder(info().artifactId()).append('-').append(actualVersion); if (!artifact.classifier().isEmpty()) { - artifact_name.append("-").append(artifact.classifier()); + artifact_name.append('-').append(artifact.classifier()); } var type = artifact.type(); if (type == null) { type = "jar"; } - artifact_name.append(".").append(type); + artifact_name.append('.').append(type); executePublishFileArtifact(repository, artifact.file(), info().version() + "/" + artifact_name); } diff --git a/src/main/java/rife/bld/wrapper/Wrapper.java b/src/main/java/rife/bld/wrapper/Wrapper.java index 19c2d1c..1ff47a9 100644 --- a/src/main/java/rife/bld/wrapper/Wrapper.java +++ b/src/main/java/rife/bld/wrapper/Wrapper.java @@ -364,7 +364,7 @@ private String downloadUrl(String version, String fileName) { var location = getWrapperDownloadLocation(version); var result = new StringBuilder(location); if (!location.endsWith("/")) { - result.append("/"); + result.append('/'); } result.append(fileName); return result.toString(); diff --git a/src/main/java/rife/bld/wrapper/WrapperExtensionResolver.java b/src/main/java/rife/bld/wrapper/WrapperExtensionResolver.java index c0b9f5d..1239a0c 100644 --- a/src/main/java/rife/bld/wrapper/WrapperExtensionResolver.java +++ b/src/main/java/rife/bld/wrapper/WrapperExtensionResolver.java @@ -134,7 +134,7 @@ private void writeHash() { contents.append(fingerPrintHash_); for (var file : localArtifacts_) { if (file.exists() && file.canRead()) { - contents.append("\n").append(file.lastModified()).append(":").append(file.getAbsolutePath()); + contents.append("\n").append(file.lastModified()).append(':').append(file.getAbsolutePath()); } } diff --git a/src/test/java/rife/bld/operations/TestJarOperation.java b/src/test/java/rife/bld/operations/TestJarOperation.java index 46a3174..8f70192 100644 --- a/src/test/java/rife/bld/operations/TestJarOperation.java +++ b/src/test/java/rife/bld/operations/TestJarOperation.java @@ -161,7 +161,7 @@ void testExecute() while (e.hasMoreElements()) { var jar_entry = e.nextElement(); content.append(jar_entry.getName()); - content.append("\n"); + content.append('\n'); } } @@ -203,7 +203,7 @@ void testFromProject() while (e.hasMoreElements()) { var jar_entry = e.nextElement(); content.append(jar_entry.getName()); - content.append("\n"); + content.append('\n'); } } diff --git a/src/test/java/rife/bld/operations/TestWarOperation.java b/src/test/java/rife/bld/operations/TestWarOperation.java index d3925e4..ee91dd6 100644 --- a/src/test/java/rife/bld/operations/TestWarOperation.java +++ b/src/test/java/rife/bld/operations/TestWarOperation.java @@ -138,7 +138,7 @@ void testFromProject() while (e.hasMoreElements()) { var jar_entry = e.nextElement(); content.append(jar_entry.getName()); - content.append("\n"); + content.append('\n'); } } From 89eb658d736334ad1d00a3ac13a3ed1efcfdf1c7 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Fri, 15 Sep 2023 06:26:33 -0700 Subject: [PATCH 06/15] Fix chained appends --- src/main/java/rife/bld/BaseProject.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/rife/bld/BaseProject.java b/src/main/java/rife/bld/BaseProject.java index ebecc31..67350c1 100644 --- a/src/main/java/rife/bld/BaseProject.java +++ b/src/main/java/rife/bld/BaseProject.java @@ -1558,10 +1558,10 @@ private String createHash() { } } } - finger_print.append(downloadSources()); - finger_print.append('\n'); - finger_print.append(downloadJavadoc()); - finger_print.append('\n'); + finger_print.append(downloadSources()) + .append('\n') + .append(downloadJavadoc()) + .append('\n'); try { var digest = MessageDigest.getInstance("SHA-1"); From 7009e54c7113943b435de9644e7e0b129c2def98 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Fri, 15 Sep 2023 06:40:58 -0700 Subject: [PATCH 07/15] Fixed excessive String concatenations in loop --- .../java/rife/bld/operations/AbstractCreateOperation.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/rife/bld/operations/AbstractCreateOperation.java b/src/main/java/rife/bld/operations/AbstractCreateOperation.java index ec5a23d..eafc699 100644 --- a/src/main/java/rife/bld/operations/AbstractCreateOperation.java +++ b/src/main/java/rife/bld/operations/AbstractCreateOperation.java @@ -220,13 +220,17 @@ protected void executePopulateProjectStructure() for (var entry : project_.dependencies().entrySet()) { build_template.blankValue("dependencies"); + var version_string = new StringBuilder(0); for (var dependency : entry.getValue()) { build_template.setValue("groupId", dependency.groupId()); build_template.setValue("artifactId", dependency.artifactId()); var version = dependency.version(); - var version_string = version.major() + "," + version.minor() + "," + version.revision(); + version_string.setLength(0); + version_string.append(version.major()).append(',') + .append(version.minor()).append(',') + .append(version.revision()); if (!version.qualifier().isEmpty()) { - version_string += ",\"" + version.qualifier() + "\""; + version_string.append(",\"" ).append(version.qualifier()).append('"'); } build_template.setValue("version", version_string); build_template.appendBlock("dependencies", "dependency"); From f6cb944565848b0ba4b102997128ecd199576a48 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Fri, 15 Sep 2023 06:58:34 -0700 Subject: [PATCH 08/15] Replaced more append("x") with append('x') where applicable --- src/main/java/rife/bld/dependencies/Dependency.java | 4 ++-- src/main/java/rife/bld/dependencies/VersionNumber.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/rife/bld/dependencies/Dependency.java b/src/main/java/rife/bld/dependencies/Dependency.java index bd7f778..a18c7c7 100644 --- a/src/main/java/rife/bld/dependencies/Dependency.java +++ b/src/main/java/rife/bld/dependencies/Dependency.java @@ -134,13 +134,13 @@ public String toFileName() { if (!classifier().isEmpty()) { result.append('-').append(classifier()); } - result.append(".").append(type()); + result.append('.').append(type()); return result.toString(); } public String toString() { - var result = new StringBuilder(groupId).append(":").append(artifactId); + var result = new StringBuilder(groupId).append(':').append(artifactId); if (!version.equals(VersionNumber.UNKNOWN)) { result.append(':').append(version); } diff --git a/src/main/java/rife/bld/dependencies/VersionNumber.java b/src/main/java/rife/bld/dependencies/VersionNumber.java index e6b245e..a205e75 100644 --- a/src/main/java/rife/bld/dependencies/VersionNumber.java +++ b/src/main/java/rife/bld/dependencies/VersionNumber.java @@ -219,7 +219,7 @@ public String toString() { var version = new StringBuilder(); version.append(majorInt()); if (minor != null || revision != null) { - version.append("."); + version.append('.'); version.append(minorInt()); } if (revision != null) { From 261b5d456a71edcac7d53b7a9bbac8a835ff2250 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Fri, 29 Sep 2023 04:14:54 -0700 Subject: [PATCH 09/15] Added SONAYTPE_RELEASES_LEGACY repository --- src/main/java/rife/bld/dependencies/Repository.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/rife/bld/dependencies/Repository.java b/src/main/java/rife/bld/dependencies/Repository.java index 27641f7..1f089fc 100644 --- a/src/main/java/rife/bld/dependencies/Repository.java +++ b/src/main/java/rife/bld/dependencies/Repository.java @@ -24,6 +24,7 @@ public record Repository(String location, String username, String password) { public static final Repository GOOGLE = new Repository("https://maven.google.com/"); public static final Repository MAVEN_CENTRAL = new Repository("https://repo1.maven.org/maven2/"); public static final Repository SONATYPE_RELEASES = new Repository("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"); + public static final Repository SONATYPE_RELEASES_LEGACY = new Repository("https://oss.sonatype.org/service/local/staging/deploy/maven2/"); public static final Repository SONATYPE_SNAPSHOTS = new Repository("https://s01.oss.sonatype.org/content/repositories/snapshots/"); public static final Repository SONATYPE_SNAPSHOTS_LEGACY = new Repository("https://oss.sonatype.org/content/repositories/snapshots/"); public static final Repository APACHE = new Repository("https://repo.maven.apache.org/maven2/"); From 76cba6ed7ace70af8d5162dcf8df4c3d6b9dbbb3 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Fri, 29 Sep 2023 05:30:33 -0700 Subject: [PATCH 10/15] Added GOOGLE and SONATYPE_RELEASE_LEGACY to resolveRepository method. --- src/main/java/rife/bld/dependencies/Repository.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/rife/bld/dependencies/Repository.java b/src/main/java/rife/bld/dependencies/Repository.java index 1f089fc..48199f9 100644 --- a/src/main/java/rife/bld/dependencies/Repository.java +++ b/src/main/java/rife/bld/dependencies/Repository.java @@ -82,9 +82,11 @@ public static Repository resolveRepository(HierarchicalProperties properties, St } return switch (locationOrName) { + case "GOOGLE" -> Repository.GOOGLE; case "MAVEN_LOCAL" -> Repository.MAVEN_LOCAL; case "MAVEN_CENTRAL" -> Repository.MAVEN_CENTRAL; case "SONATYPE_RELEASES" -> Repository.SONATYPE_RELEASES; + case "SONATYPE_RELEASES_LEGACY" -> Repository.SONATYPE_RELEASES_LEGACY; case "SONATYPE_SNAPSHOTS" -> Repository.SONATYPE_SNAPSHOTS; case "SONATYPE_SNAPSHOTS_LEGACY" -> Repository.SONATYPE_SNAPSHOTS_LEGACY; case "APACHE" -> Repository.APACHE; From 1ab53f5bada5575eced3d3b2a1a71e8f891576c0 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Fri, 29 Sep 2023 05:41:32 -0700 Subject: [PATCH 11/15] Cleaned up sign exception --- src/main/java/rife/bld/operations/PublishOperation.java | 4 ++-- .../java/rife/bld/operations/exceptions/SignException.java | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/rife/bld/operations/PublishOperation.java b/src/main/java/rife/bld/operations/PublishOperation.java index 7fb0a9d..2f9e155 100644 --- a/src/main/java/rife/bld/operations/PublishOperation.java +++ b/src/main/java/rife/bld/operations/PublishOperation.java @@ -348,12 +348,12 @@ protected String executeSignFile(File file) try { process.waitFor(); } catch (InterruptedException e) { - throw new SignException(file, e); + throw new SignException(file, new InterruptedException(e.getMessage())); } if (process.exitValue() != 0) { var error = FileUtils.readString(process.getErrorStream()); - throw new SignException(file); + throw new SignException(file, new IOException(error)); } return FileUtils.readString(process.getInputStream()); } diff --git a/src/main/java/rife/bld/operations/exceptions/SignException.java b/src/main/java/rife/bld/operations/exceptions/SignException.java index e3de0fc..d921c19 100644 --- a/src/main/java/rife/bld/operations/exceptions/SignException.java +++ b/src/main/java/rife/bld/operations/exceptions/SignException.java @@ -19,10 +19,6 @@ public class SignException extends RuntimeException { private final File file_; private final String reason_; - public SignException(File file) { - this(file, null); - } - public SignException(File file, Throwable reason) { super("An error occurred while signing '" + file, reason); file_ = file; From 87735bb88e05d31b68122612099bc86f21ee79b8 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Fri, 29 Sep 2023 10:27:09 -0700 Subject: [PATCH 12/15] Reverted sign exception modifications --- src/main/java/rife/bld/operations/PublishOperation.java | 4 ++-- .../rife/bld/operations/exceptions/SignException.java | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/rife/bld/operations/PublishOperation.java b/src/main/java/rife/bld/operations/PublishOperation.java index 2f9e155..9385fb9 100644 --- a/src/main/java/rife/bld/operations/PublishOperation.java +++ b/src/main/java/rife/bld/operations/PublishOperation.java @@ -348,12 +348,12 @@ protected String executeSignFile(File file) try { process.waitFor(); } catch (InterruptedException e) { - throw new SignException(file, new InterruptedException(e.getMessage())); + throw new SignException(file, e.getMessage()); } if (process.exitValue() != 0) { var error = FileUtils.readString(process.getErrorStream()); - throw new SignException(file, new IOException(error)); + throw new SignException(file, error); } return FileUtils.readString(process.getInputStream()); } diff --git a/src/main/java/rife/bld/operations/exceptions/SignException.java b/src/main/java/rife/bld/operations/exceptions/SignException.java index d921c19..eab071d 100644 --- a/src/main/java/rife/bld/operations/exceptions/SignException.java +++ b/src/main/java/rife/bld/operations/exceptions/SignException.java @@ -19,12 +19,10 @@ public class SignException extends RuntimeException { private final File file_; private final String reason_; - public SignException(File file, Throwable reason) { - super("An error occurred while signing '" + file, reason); + public SignException(File file, String reason) { + super("An error occurred while signing '" + file + "':\n" + reason); file_ = file; - if (reason.getCause() != null && reason.getCause().getMessage() != null) - reason_ = reason.getCause().getMessage(); - else reason_ = ""; + reason_ = reason; } public File getFile() { From ec01a626ae19059fffa100f63c3354a4e0e538da Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Sat, 30 Sep 2023 10:22:09 -0700 Subject: [PATCH 13/15] Revert some changes per Geert comments --- src/bld/java/rife/BldBuild.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bld/java/rife/BldBuild.java b/src/bld/java/rife/BldBuild.java index a6550ce..8626a87 100644 --- a/src/bld/java/rife/BldBuild.java +++ b/src/bld/java/rife/BldBuild.java @@ -132,9 +132,11 @@ public void zipBld() f.perms(0755); }); }); - b.dir("lib", l -> l.file("bld-wrapper.jar", f -> f.move(path(tmp, "lib", "bld", "bld-wrapper.jar")))); + b.dir("lib", l -> { + l.file("bld-wrapper.jar", f -> f.move(path(tmp, "lib", "bld", "bld-wrapper.jar"))); + }); }); - t.dir("lib", DirBuilder::delete); + t.dir("lib", l -> l.delete()); }); zipBldOperation From 4ac6490dec1a19561969178bc639e63f0c4c538f Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Sun, 1 Oct 2023 10:30:50 -0700 Subject: [PATCH 14/15] Removed unused imports --- .../java/rife/bld/dependencies/ArtifactRetriever.java | 8 +++++++- src/test/java/rife/bld/operations/TestJUnitOperation.java | 1 - .../java/rife/bld/operations/TestUberJarOperation.java | 1 - .../java/rife/bld/operations/TestUpdatesOperation.java | 1 - src/test/java/rife/bld/operations/TestWarOperation.java | 1 - 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/rife/bld/dependencies/ArtifactRetriever.java b/src/main/java/rife/bld/dependencies/ArtifactRetriever.java index 7364fac..cf74e3b 100644 --- a/src/main/java/rife/bld/dependencies/ArtifactRetriever.java +++ b/src/main/java/rife/bld/dependencies/ArtifactRetriever.java @@ -189,7 +189,13 @@ public boolean transferIntoDirectory(RepositoryArtifact artifact, File directory } private static URLConnection openUrlConnection(RepositoryArtifact artifact) throws IOException { - var connection = new URL(artifact.location()).openConnection(); + String location; + if (artifact.location().matches("[a-z][a-z0-9+\\-.]*://.*")) { + location = artifact.location(); + } else { + location = new File(artifact.location()).toURI().toString(); + } + var connection = new URL(location).openConnection(); connection.setUseCaches(false); connection.setRequestProperty("User-Agent", "bld " + BldVersion.getVersion()); return connection; diff --git a/src/test/java/rife/bld/operations/TestJUnitOperation.java b/src/test/java/rife/bld/operations/TestJUnitOperation.java index a2b1c43..a49927d 100644 --- a/src/test/java/rife/bld/operations/TestJUnitOperation.java +++ b/src/test/java/rife/bld/operations/TestJUnitOperation.java @@ -13,7 +13,6 @@ import java.util.function.Function; import static org.junit.jupiter.api.Assertions.*; -import static org.junit.jupiter.api.Assertions.assertNull; public class TestJUnitOperation { @Test diff --git a/src/test/java/rife/bld/operations/TestUberJarOperation.java b/src/test/java/rife/bld/operations/TestUberJarOperation.java index 1a022a0..95051d4 100644 --- a/src/test/java/rife/bld/operations/TestUberJarOperation.java +++ b/src/test/java/rife/bld/operations/TestUberJarOperation.java @@ -19,7 +19,6 @@ import java.util.jar.JarFile; import static org.junit.jupiter.api.Assertions.*; -import static org.junit.jupiter.api.Assertions.assertEquals; public class TestUberJarOperation { @Test diff --git a/src/test/java/rife/bld/operations/TestUpdatesOperation.java b/src/test/java/rife/bld/operations/TestUpdatesOperation.java index ff966fa..f8ba73c 100644 --- a/src/test/java/rife/bld/operations/TestUpdatesOperation.java +++ b/src/test/java/rife/bld/operations/TestUpdatesOperation.java @@ -5,7 +5,6 @@ package rife.bld.operations; import org.junit.jupiter.api.Test; -import rife.bld.dependencies.DependencyScopes; import rife.bld.WebProject; import rife.bld.dependencies.*; import rife.tools.FileUtils; diff --git a/src/test/java/rife/bld/operations/TestWarOperation.java b/src/test/java/rife/bld/operations/TestWarOperation.java index ee91dd6..077e2bb 100644 --- a/src/test/java/rife/bld/operations/TestWarOperation.java +++ b/src/test/java/rife/bld/operations/TestWarOperation.java @@ -15,7 +15,6 @@ import java.util.regex.Pattern; import static org.junit.jupiter.api.Assertions.*; -import static org.junit.jupiter.api.Assertions.assertEquals; public class TestWarOperation { @Test From f00418b4c2e139ac318cfd7b9e87a8da51c017d5 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Sun, 1 Oct 2023 10:51:25 -0700 Subject: [PATCH 15/15] Revert unwanted previous commit --- .../java/rife/bld/dependencies/ArtifactRetriever.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/rife/bld/dependencies/ArtifactRetriever.java b/src/main/java/rife/bld/dependencies/ArtifactRetriever.java index cf74e3b..7364fac 100644 --- a/src/main/java/rife/bld/dependencies/ArtifactRetriever.java +++ b/src/main/java/rife/bld/dependencies/ArtifactRetriever.java @@ -189,13 +189,7 @@ public boolean transferIntoDirectory(RepositoryArtifact artifact, File directory } private static URLConnection openUrlConnection(RepositoryArtifact artifact) throws IOException { - String location; - if (artifact.location().matches("[a-z][a-z0-9+\\-.]*://.*")) { - location = artifact.location(); - } else { - location = new File(artifact.location()).toURI().toString(); - } - var connection = new URL(location).openConnection(); + var connection = new URL(artifact.location()).openConnection(); connection.setUseCaches(false); connection.setRequestProperty("User-Agent", "bld " + BldVersion.getVersion()); return connection;