diff --git a/.idea/misc.xml b/.idea/misc.xml
index 46607c8..065a1fd 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,4 +1,3 @@
-
@@ -6,4 +5,4 @@
-
+
\ No newline at end of file
diff --git a/core b/core
index 0ad243b..88f7cb4 160000
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit 0ad243b95e76bb506e625822a0f7ef9d03733f71
+Subproject commit 88f7cb4af908d8c093ba9b72e6fc9c7e189fe6e5
diff --git a/src/main/java/rife/bld/dependencies/Repository.java b/src/main/java/rife/bld/dependencies/Repository.java
index cdff56f..2eb7fdd 100644
--- a/src/main/java/rife/bld/dependencies/Repository.java
+++ b/src/main/java/rife/bld/dependencies/Repository.java
@@ -7,8 +7,10 @@
import rife.ioc.HierarchicalProperties;
import rife.tools.StringEncryptor;
+import java.io.File;
import java.nio.file.Path;
import java.security.NoSuchAlgorithmException;
+import java.util.regex.Pattern;
/**
* Contains the information required to locate a Maven-compatible repository.
@@ -103,6 +105,12 @@ public Repository(String location) {
this(location, null, null);
}
+ private final static Pattern WINDOWS_ABSOLUTE_PATH = Pattern.compile("^\\p{L}:\\\\");
+
+ private boolean isWindowsLocation() {
+ return WINDOWS_ABSOLUTE_PATH.matcher(location()).find();
+ }
+
/**
* Indicates whether this repository is local.
*
@@ -111,7 +119,7 @@ public Repository(String location) {
* @since 1.5.10
*/
public boolean isLocal() {
- return location().startsWith("/") || location().startsWith("file:");
+ return location().startsWith("/") || location().startsWith("file:") || isWindowsLocation();
}
/**
@@ -147,9 +155,10 @@ public String getArtifactLocation(Dependency dependency) {
* @since 1.5.10
*/
public String getArtifactLocation(String groupId, String artifactId) {
- var group_path = groupId.replace(".", "/");
+ var separator = "/";
var result = new StringBuilder();
if (isLocal()) {
+ separator = File.separator;
if (location().startsWith("file://")) {
result.append(location().substring("file://".length()));
} else {
@@ -158,10 +167,11 @@ public String getArtifactLocation(String groupId, String artifactId) {
} else {
result.append(location());
}
- if (!location().endsWith("/")) {
- result.append("/");
+ if (!location().endsWith(separator)) {
+ result.append(separator);
}
- return result.append(group_path).append("/").append(artifactId).append("/").toString();
+ var group_path = groupId.replace(".", separator);
+ return result.append(group_path).append(separator).append(artifactId).append(separator).toString();
}
/**
diff --git a/src/test/java/rife/bld/dependencies/TestDependencySet.java b/src/test/java/rife/bld/dependencies/TestDependencySet.java
index 5c0cbca..e21341f 100644
--- a/src/test/java/rife/bld/dependencies/TestDependencySet.java
+++ b/src/test/java/rife/bld/dependencies/TestDependencySet.java
@@ -57,25 +57,25 @@ void testAddAll() {
var set_union1 = new DependencySet(set1);
set_union1.addAll(set2);
- assertEquals("""
+ assertEquals(StringUtils.convertLineSeparator("""
org.eclipse.jetty:jetty-server:11.0.14
org.eclipse.jetty.toolchain:jetty-jakarta-servlet-api:5.0.2
org.eclipse.jetty:jetty-http:11.0.14
org.eclipse.jetty:jetty-io:11.0.14
org.eclipse.jetty:jetty-util:11.0.14
org.slf4j:slf4j-simple:2.0.6
- org.slf4j:slf4j-api:2.0.6""", StringUtils.join(set_union1, "\n"));
+ org.slf4j:slf4j-api:2.0.6"""), StringUtils.join(set_union1, System.lineSeparator()));
var set_union2 = new DependencySet(set2);
set_union2.addAll(set1);
- assertEquals("""
+ assertEquals(StringUtils.convertLineSeparator("""
org.slf4j:slf4j-simple:2.0.6
org.slf4j:slf4j-api:2.0.6
org.eclipse.jetty:jetty-server:11.0.14
org.eclipse.jetty.toolchain:jetty-jakarta-servlet-api:5.0.2
org.eclipse.jetty:jetty-http:11.0.14
org.eclipse.jetty:jetty-io:11.0.14
- org.eclipse.jetty:jetty-util:11.0.14""", StringUtils.join(set_union2, "\n"));
+ org.eclipse.jetty:jetty-util:11.0.14"""), StringUtils.join(set_union2, System.lineSeparator()));
}
@Test
@@ -83,7 +83,7 @@ void testGenerateDependencyTreeJettySlf4j() {
var dependencies = new DependencySet()
.include(new Dependency("org.eclipse.jetty", "jetty-server", new VersionNumber(11, 0, 14)))
.include(new Dependency("org.slf4j", "slf4j-simple", new VersionNumber(2, 0, 6)));
- assertEquals("""
+ assertEquals(StringUtils.convertLineSeparator("""
├─ org.eclipse.jetty:jetty-server:11.0.14
│ ├─ org.eclipse.jetty.toolchain:jetty-jakarta-servlet-api:5.0.2
│ ├─ org.eclipse.jetty:jetty-http:11.0.14
@@ -91,14 +91,14 @@ void testGenerateDependencyTreeJettySlf4j() {
│ └─ org.eclipse.jetty:jetty-io:11.0.14
└─ org.slf4j:slf4j-simple:2.0.6
└─ org.slf4j:slf4j-api:2.0.6
- """, dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
+ """), dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
}
@Test
void testGenerateDependencyTreeSpringBoot() {
var dependencies = new DependencySet()
.include(new Dependency("org.springframework.boot", "spring-boot-starter", new VersionNumber(3, 0, 4)));
- assertEquals("""
+ assertEquals(StringUtils.convertLineSeparator("""
└─ org.springframework.boot:spring-boot-starter:3.0.4
├─ org.springframework.boot:spring-boot:3.0.4
│ └─ org.springframework:spring-context:6.0.6
@@ -117,14 +117,14 @@ void testGenerateDependencyTreeSpringBoot() {
├─ org.springframework:spring-core:6.0.6
│ └─ org.springframework:spring-jcl:6.0.6
└─ org.yaml:snakeyaml:1.33
- """, dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
+ """), dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
}
@Test
void testGenerateDependencyTreeMaven() {
var dependencies = new DependencySet()
.include(new Dependency("org.apache.maven", "maven-core", new VersionNumber(3, 9, 0)));
- assertEquals("""
+ assertEquals(StringUtils.convertLineSeparator("""
└─ org.apache.maven:maven-core:3.9.0
├─ org.apache.maven:maven-model:3.9.0
├─ org.apache.maven:maven-settings:3.9.0
@@ -157,14 +157,14 @@ void testGenerateDependencyTreeMaven() {
├─ org.codehaus.plexus:plexus-component-annotations:2.1.0
├─ org.apache.commons:commons-lang3:3.8.1
└─ org.slf4j:slf4j-api:1.7.36
- """, dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
+ """), dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
}
@Test
void testGenerateDependencyTreePlay() {
var dependencies = new DependencySet()
.include(new Dependency("com.typesafe.play", "play_2.13", new VersionNumber(2, 8, 19)));
- assertEquals("""
+ assertEquals(StringUtils.convertLineSeparator("""
└─ com.typesafe.play:play_2.13:2.8.19
├─ org.scala-lang:scala-library:2.13.10
├─ com.typesafe.play:build-link:2.8.19
@@ -213,14 +213,14 @@ void testGenerateDependencyTreePlay() {
├─ org.scala-lang.modules:scala-java8-compat_2.13:1.0.2
├─ com.typesafe:ssl-config-core_2.13:0.4.3
└─ org.scala-lang.modules:scala-parser-combinators_2.13:1.1.2
- """, dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
+ """), dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
}
@Test
void testGenerateDependencyTreeVaadin() {
var dependencies = new DependencySet()
.include(new Dependency("com.vaadin", "vaadin", new VersionNumber(23, 3, 7)));
- assertEquals("""
+ assertEquals(StringUtils.convertLineSeparator("""
└─ com.vaadin:vaadin:23.3.7
├─ com.vaadin:vaadin-core:23.3.7
│ ├─ com.vaadin:flow-server:23.3.4
@@ -309,7 +309,7 @@ void testGenerateDependencyTreeVaadin() {
│ ├─ net.java.dev.jna:jna:5.11.0
│ └─ net.java.dev.jna:jna-platform:5.11.0
└─ com.auth0:java-jwt:3.19.2
- """, dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
+ """), dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
}
@Test
@@ -324,7 +324,7 @@ void testGenerateDependencyTreeVarious() {
.include(new Dependency("commons-codec", "commons-codec", new VersionNumber(1,15)))
.include(new Dependency("org.apache.httpcomponents", "httpcore", new VersionNumber(4,4,16)))
.include(new Dependency("com.google.zxing", "javase", new VersionNumber(3,5,1)));
- assertEquals("""
+ assertEquals(StringUtils.convertLineSeparator("""
├─ com.uwyn.rife2:rife2:1.5.20
├─ com.stripe:stripe-java:20.136.0
├─ org.json:json:20230227
@@ -352,14 +352,14 @@ void testGenerateDependencyTreeVarious() {
└─ com.google.zxing:javase:3.5.1
├─ com.google.zxing:core:3.5.1
└─ com.beust:jcommander:1.82
- """, dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
+ """), dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
}
@Test
void testGenerateDependencyTreeCompileRuntime() {
var dependencies = new DependencySet()
.include(new Dependency("net.thauvin.erik", "bitly-shorten", new VersionNumber(0, 9, 4, "SNAPSHOT")));
- assertEquals("""
+ assertEquals(StringUtils.convertLineSeparator("""
└─ net.thauvin.erik:bitly-shorten:0.9.4-SNAPSHOT
├─ org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22
│ ├─ org.jetbrains.kotlin:kotlin-stdlib:1.8.22
@@ -371,6 +371,6 @@ void testGenerateDependencyTreeCompileRuntime() {
│ └─ com.squareup.okio:okio-jvm:3.2.0
├─ com.squareup.okhttp3:logging-interceptor:4.11.0
└─ org.json:json:20230618
- """, dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY), compile, runtime));
+ """), dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY), compile, runtime));
}
}
diff --git a/src/test/java/rife/bld/operations/TestCompileOperation.java b/src/test/java/rife/bld/operations/TestCompileOperation.java
index 51bbb88..fc6b478 100644
--- a/src/test/java/rife/bld/operations/TestCompileOperation.java
+++ b/src/test/java/rife/bld/operations/TestCompileOperation.java
@@ -11,6 +11,7 @@
import javax.tools.DiagnosticCollector;
import javax.tools.JavaFileObject;
import java.io.File;
+import java.net.URL;
import java.nio.file.Files;
import java.util.List;
@@ -305,11 +306,11 @@ public void executeProcessDiagnostics(DiagnosticCollector diagno
var diagnostic4 = operation.diagnostics().get(3);
var diagnostic5 = operation.diagnostics().get(4);
- assertEquals("/Source1.java", diagnostic1.getSource().toUri().getPath().substring(tmp.getAbsolutePath().length()));
- assertEquals("/Source3.java", diagnostic2.getSource().toUri().getPath().substring(tmp.getAbsolutePath().length()));
- assertEquals("/Source3.java", diagnostic3.getSource().toUri().getPath().substring(tmp.getAbsolutePath().length()));
- assertEquals("/Source3.java", diagnostic4.getSource().toUri().getPath().substring(tmp.getAbsolutePath().length()));
- assertEquals("/Source3.java", diagnostic5.getSource().toUri().getPath().substring(tmp.getAbsolutePath().length()));
+ assertEquals("Source1.java", diagnostic1.getSource().toUri().getPath().substring(tmp.toURI().getPath().length()));
+ assertEquals("Source3.java", diagnostic2.getSource().toUri().getPath().substring(tmp.toURI().getPath().length()));
+ assertEquals("Source3.java", diagnostic3.getSource().toUri().getPath().substring(tmp.toURI().getPath().length()));
+ assertEquals("Source3.java", diagnostic4.getSource().toUri().getPath().substring(tmp.toURI().getPath().length()));
+ assertEquals("Source3.java", diagnostic5.getSource().toUri().getPath().substring(tmp.toURI().getPath().length()));
assertFalse(build_main_class1.exists());
assertFalse(build_main_class2.exists());
diff --git a/src/test/java/rife/bld/operations/TestDependencyTreeOperation.java b/src/test/java/rife/bld/operations/TestDependencyTreeOperation.java
index 984917f..a15bef2 100644
--- a/src/test/java/rife/bld/operations/TestDependencyTreeOperation.java
+++ b/src/test/java/rife/bld/operations/TestDependencyTreeOperation.java
@@ -8,6 +8,7 @@
import rife.bld.WebProject;
import rife.bld.dependencies.*;
import rife.tools.FileUtils;
+import rife.tools.StringUtils;
import java.io.File;
import java.nio.file.Files;
@@ -80,7 +81,7 @@ void testExecution()
var tree = operation.dependencyTree();
- assertEquals("""
+ assertEquals(StringUtils.convertLineSeparator("""
compile:
├─ com.uwyn.rife2:rife2:1.5.20
├─ com.stripe:stripe-java:20.136.0
@@ -120,7 +121,7 @@ void testExecution()
test:
no dependencies
- """, tree);
+ """), tree);
} finally {
FileUtils.deleteDirectory(tmp);
}
@@ -152,7 +153,7 @@ void testExecutionProvidedTest()
var tree = operation.dependencyTree();
- assertEquals("""
+ assertEquals(StringUtils.convertLineSeparator("""
compile:
no dependencies
@@ -188,7 +189,7 @@ void testExecutionProvidedTest()
│ └─ org.eclipse.jetty:jetty-security:11.0.15
└─ net.imagej:ij:1.54d
- """, tree);
+ """), tree);
} finally {
FileUtils.deleteDirectory(tmp);
}
@@ -229,7 +230,7 @@ void testFromProject()
var tree = operation.dependencyTree();
- assertEquals("""
+ assertEquals(StringUtils.convertLineSeparator("""
compile:
├─ com.uwyn.rife2:rife2:1.5.20
├─ com.stripe:stripe-java:20.136.0
@@ -269,7 +270,7 @@ void testFromProject()
test:
no dependencies
- """, tree);
+ """), tree);
} finally {
FileUtils.deleteDirectory(tmp);
}
@@ -305,7 +306,7 @@ void testFromProjectProvidedTest()
var tree = operation.dependencyTree();
- assertEquals("""
+ assertEquals(StringUtils.convertLineSeparator("""
compile:
no dependencies
@@ -341,7 +342,7 @@ void testFromProjectProvidedTest()
│ └─ org.eclipse.jetty:jetty-security:11.0.15
└─ net.imagej:ij:1.54d
- """, tree);
+ """), tree);
} finally {
FileUtils.deleteDirectory(tmp);
}
diff --git a/src/test/java/rife/bld/operations/TestJUnitOperation.java b/src/test/java/rife/bld/operations/TestJUnitOperation.java
index a2b1c43..e3a502b 100644
--- a/src/test/java/rife/bld/operations/TestJUnitOperation.java
+++ b/src/test/java/rife/bld/operations/TestJUnitOperation.java
@@ -6,6 +6,7 @@
import org.junit.jupiter.api.Test;
import rife.tools.FileUtils;
+import rife.tools.StringUtils;
import java.io.File;
import java.nio.file.Files;
@@ -191,7 +192,7 @@ void testFromProject()
return true;
})
.execute();
- assertTrue(check_result.toString().contains("""
+ assertTrue(check_result.toString().contains(StringUtils.convertLineSeparator("""
[ 2 containers found ]
[ 0 containers skipped ]
[ 2 containers started ]
@@ -204,7 +205,7 @@ void testFromProject()
[ 0 tests aborted ]
[ 1 tests successful ]
[ 0 tests failed ]
- """));
+ """)));
} finally {
FileUtils.deleteDirectory(tmp);
diff --git a/src/test/java/rife/bld/operations/TestJavadocOperation.java b/src/test/java/rife/bld/operations/TestJavadocOperation.java
index 6224d84..672bcef 100644
--- a/src/test/java/rife/bld/operations/TestJavadocOperation.java
+++ b/src/test/java/rife/bld/operations/TestJavadocOperation.java
@@ -354,7 +354,7 @@ public void executeProcessDiagnostics(DiagnosticCollector diagno
var diagnostic1 = operation.diagnostics().get(0);
- assertEquals("/Source1.java", diagnostic1.getSource().toUri().getPath().substring(tmp.getAbsolutePath().length()));
+ assertEquals("Source1.java", diagnostic1.getSource().toUri().getPath().substring(tmp.toURI().getPath().length()));
assertFalse(build_html1.exists());
assertFalse(build_html2.exists());
diff --git a/src/test/java/rife/bld/publish/TestPomBuilder.java b/src/test/java/rife/bld/publish/TestPomBuilder.java
index 268b26d..582cbaa 100644
--- a/src/test/java/rife/bld/publish/TestPomBuilder.java
+++ b/src/test/java/rife/bld/publish/TestPomBuilder.java
@@ -9,6 +9,7 @@
import rife.bld.dependencies.DependencyScopes;
import rife.bld.dependencies.Scope;
import rife.bld.dependencies.VersionNumber;
+import rife.tools.StringUtils;
import java.io.File;
import java.io.IOException;
@@ -108,7 +109,7 @@ void testGenerateInto() throws IOException {
PomBuilder.generateInto(new PublishInfo().name("the thing"), deps, temp);
- assertEquals("""
+ assertEquals(StringUtils.convertLineSeparator("""
@@ -126,7 +127,7 @@ void testGenerateInto() throws IOException {
compile
- """, String.join(System.lineSeparator(), Files.readAllLines(temp.toPath())));
+ """), String.join(System.lineSeparator(), Files.readAllLines(temp.toPath())));
}
@Test