diff --git a/core b/core index bd78138..2cf670d 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit bd78138d0e5ca6afd542b1d68ab706ae2b123807 +Subproject commit 2cf670d576120309afd11f9f879a000e18ed6521 diff --git a/lib/bld/bld-wrapper.jar b/lib/bld/bld-wrapper.jar index 4836387..6663753 100644 Binary files a/lib/bld/bld-wrapper.jar and b/lib/bld/bld-wrapper.jar differ diff --git a/src/bld/java/rife/BldBuild.java b/src/bld/java/rife/BldBuild.java index 0ce9310..8102179 100644 --- a/src/bld/java/rife/BldBuild.java +++ b/src/bld/java/rife/BldBuild.java @@ -6,6 +6,7 @@ import rife.bld.BuildCommand; import rife.bld.Cli; +import rife.bld.dependencies.VersionNumber; import rife.bld.extension.ZipOperation; import rife.bld.operations.*; import rife.bld.publish.*; @@ -28,7 +29,7 @@ public BldBuild() throws Exception { name = "bld"; mainClass = "rife.bld.Cli"; - version = version(FileUtils.readString(new File(srcMainResourcesDirectory(), "BLD_VERSION"))); + version = VersionNumber.parse(FileUtils.readString(new File(srcMainResourcesDirectory(), "BLD_VERSION"))); repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES); scope(test) diff --git a/src/main/java/rife/bld/BaseProject.java b/src/main/java/rife/bld/BaseProject.java index 431d065..6833a6d 100644 --- a/src/main/java/rife/bld/BaseProject.java +++ b/src/main/java/rife/bld/BaseProject.java @@ -52,7 +52,7 @@ public class BaseProject extends BuildExecutor { * @see #version() * @since 1.5 */ - protected Version version = null; + protected VersionNumber version = null; /** * The project's main class. * @@ -684,7 +684,7 @@ public VersionNumber version(int major, int minor, int revision, String qualifie * @since 1.5 */ public Version version(String description) { - return VersionNumber.parse(description); + return Version.parse(description); } /** @@ -1198,7 +1198,7 @@ public String name() { * * @since 1.5 */ - public Version version() { + public VersionNumber version() { if (version == null) { throw new IllegalStateException("The version variable has to be set."); } diff --git a/src/main/java/rife/bld/dependencies/Dependency.java b/src/main/java/rife/bld/dependencies/Dependency.java index 725ce5d..9dd28c3 100644 --- a/src/main/java/rife/bld/dependencies/Dependency.java +++ b/src/main/java/rife/bld/dependencies/Dependency.java @@ -80,7 +80,7 @@ public static Dependency parse(String dependency) { var groupId = matcher.group("groupId"); var artifactId = matcher.group("artifactId"); - var version = VersionNumber.parse(matcher.group("version")); + var version = Version.parse(matcher.group("version")); var classifier = matcher.group("classifier"); var type = matcher.group("type"); diff --git a/src/main/java/rife/bld/dependencies/PomDependency.java b/src/main/java/rife/bld/dependencies/PomDependency.java index 13d19d6..151d8ae 100644 --- a/src/main/java/rife/bld/dependencies/PomDependency.java +++ b/src/main/java/rife/bld/dependencies/PomDependency.java @@ -34,7 +34,7 @@ Dependency convertToDependency() { return new Dependency( groupId(), artifactId(), - VersionNumber.parse(version()), + Version.parse(version()), classifier(), type(), exclusions(), diff --git a/src/main/java/rife/bld/dependencies/Version.java b/src/main/java/rife/bld/dependencies/Version.java index c77e7e0..bf98791 100644 --- a/src/main/java/rife/bld/dependencies/Version.java +++ b/src/main/java/rife/bld/dependencies/Version.java @@ -4,12 +4,42 @@ */ package rife.bld.dependencies; +import static rife.bld.dependencies.VersionNumber.parseOrNull; + /** * Represents the basic functionality of a dependency version. * * @since 2.0 */ public interface Version extends Comparable { + /** + * Parses a version from a string representation. + *

+ * If the string can't be successfully parsed as a semantic {@link VersionNumber}, + * it will be parsed as a {@link VersionGeneric}. + * + * @param version the version string to parse + * @return the parsed version instance + * @since 2.0 + */ + static Version parse(String version) { + if (version == null || version.isEmpty()) { + return VersionNumber.UNKNOWN; + } + + var result = parseOrNull(version); + if (result != null) { + return result; + } + + // bld doesn't support version ranges at this time + if (version.startsWith("[") || version.startsWith("(")) { + return VersionNumber.UNKNOWN; + } + + return new VersionGeneric(version); + } + /** * Retrieves the qualifier of the version. * diff --git a/src/main/java/rife/bld/dependencies/VersionGeneric.java b/src/main/java/rife/bld/dependencies/VersionGeneric.java index 977b14e..fdbe493 100644 --- a/src/main/java/rife/bld/dependencies/VersionGeneric.java +++ b/src/main/java/rife/bld/dependencies/VersionGeneric.java @@ -48,11 +48,9 @@ public VersionGeneric(String version) { } /** - * Returns this instance tokenized representation as unmodifiable list. - * - * @since 2.0 + * Visible for testing. */ - public List asItems() { + List asItems() { return items_; } @@ -72,7 +70,7 @@ private static List parse(String version) { /** * Visible for testing. */ - public static void trimPadding(List items) { + static void trimPadding(List items) { Boolean number = null; var end = items.size() - 1; for (var i = end; i > 0; i--) { diff --git a/src/main/java/rife/bld/dependencies/VersionNumber.java b/src/main/java/rife/bld/dependencies/VersionNumber.java index f52b988..90cbd39 100644 --- a/src/main/java/rife/bld/dependencies/VersionNumber.java +++ b/src/main/java/rife/bld/dependencies/VersionNumber.java @@ -37,25 +37,35 @@ public record VersionNumber(Integer major, Integer minor, Integer revision, Stri /** * Parses a version number from a string representation. *

- * If the string can't be successfully parsed, {@link VersionNumber#UNKNOWN} will be returned. + * If the string can't be successfully parsed as a semantic version, + * {@link VersionNumber#UNKNOWN} will be returned. * * @param version the version string to parse * @return a parsed instance of {@code VersionNumber}; or * {@link VersionNumber#UNKNOWN} when the string couldn't be parsed * @since 1.5 */ - public static Version parse(String version) { + public static VersionNumber parse(String version) { if (version == null || version.isEmpty()) { return UNKNOWN; } + var result = parseOrNull(version); + if (result == null) { + result = UNKNOWN; + } + + return result; + } + + static VersionNumber parseOrNull(String version) { + if (version == null) { + return null; + } + var matcher = VERSION_PATTERN.matcher(version); if (!matcher.matches()) { - // bld doesn't support version ranges at this time - if (version.startsWith("[") || version.startsWith("(")) { - return UNKNOWN; - } - return new VersionGeneric(version); + return null; } var major = matcher.group("major"); diff --git a/src/main/java/rife/bld/dependencies/Xml2MavenMetadata.java b/src/main/java/rife/bld/dependencies/Xml2MavenMetadata.java index 43f3e1c..6e1436e 100644 --- a/src/main/java/rife/bld/dependencies/Xml2MavenMetadata.java +++ b/src/main/java/rife/bld/dependencies/Xml2MavenMetadata.java @@ -63,9 +63,9 @@ public void startElement(String uri, String localName, String qName, Attributes public void endElement(String uri, String localName, String qName) { switch (qName) { - case "latest" -> latest_ = VersionNumber.parse(characterData_.toString()); - case "release" -> release_ = VersionNumber.parse(characterData_.toString()); - case "version" -> versions_.add(VersionNumber.parse(characterData_.toString())); + case "latest" -> latest_ = Version.parse(characterData_.toString()); + case "release" -> release_ = Version.parse(characterData_.toString()); + case "version" -> versions_.add(Version.parse(characterData_.toString())); case "timestamp" -> snapshotTimestamp_ = characterData_.toString(); case "buildNumber" -> snapshotBuildNumber_ = Integer.parseInt(characterData_.toString()); case "snapshot" -> isSnapshot_ = true; diff --git a/src/main/java/rife/bld/dependencies/Xml2MavenPom.java b/src/main/java/rife/bld/dependencies/Xml2MavenPom.java index 2268914..7bdb3d1 100644 --- a/src/main/java/rife/bld/dependencies/Xml2MavenPom.java +++ b/src/main/java/rife/bld/dependencies/Xml2MavenPom.java @@ -197,7 +197,7 @@ public void endElement(String uri, String localName, String qName) { switch (qName) { case "parent" -> { if (isChildOfProject()) { - var parent_dependency = new Dependency(resolveMavenProperties(lastGroupId_), resolveMavenProperties(lastArtifactId_), VersionNumber.parse(resolveMavenProperties(lastVersion_))); + var parent_dependency = new Dependency(resolveMavenProperties(lastGroupId_), resolveMavenProperties(lastArtifactId_), Version.parse(resolveMavenProperties(lastVersion_))); var parent = new DependencyResolver(resolution_, retriever_, repositories_, parent_dependency).getMavenPom(parent_); parent.mavenProperties_.keySet().removeAll(mavenProperties_.keySet()); @@ -224,7 +224,7 @@ public void endElement(String uri, String localName, String qName) { var dependency = new PomDependency(lastGroupId_, lastArtifactId_, lastVersion_, lastClassifier_, lastType_, lastScope_, lastOptional_, exclusions_, parent_); if (collectDependencyManagement_) { if (dependency.isPomImport()) { - var import_dependency = new Dependency(resolveMavenProperties(lastGroupId_), resolveMavenProperties(lastArtifactId_), VersionNumber.parse(resolveMavenProperties(lastVersion_))); + var import_dependency = new Dependency(resolveMavenProperties(lastGroupId_), resolveMavenProperties(lastArtifactId_), Version.parse(resolveMavenProperties(lastVersion_))); var imported_pom = new DependencyResolver(resolution_, retriever_, repositories_, import_dependency).getMavenPom(parent_); imported_pom.dependencyManagement_.keySet().removeAll(dependencyManagement_.keySet()); var resolved_dependencies = new LinkedHashSet(); diff --git a/src/test/java/rife/bld/dependencies/TestDependencySet.java b/src/test/java/rife/bld/dependencies/TestDependencySet.java index daaf88b..57a6459 100644 --- a/src/test/java/rife/bld/dependencies/TestDependencySet.java +++ b/src/test/java/rife/bld/dependencies/TestDependencySet.java @@ -45,16 +45,16 @@ void testPopulation() { @Test void testAddAll() { var set1 = new DependencySet() - .include(new Dependency("org.eclipse.jetty", "jetty-server", VersionNumber.parse("11.0.14"))) - .include(new Dependency("org.eclipse.jetty.toolchain", "jetty-jakarta-servlet-api", VersionNumber.parse("5.0.2"))) - .include(new Dependency("org.eclipse.jetty", "jetty-http", VersionNumber.parse("11.0.14"))) - .include(new Dependency("org.eclipse.jetty", "jetty-io", VersionNumber.parse("11.0.14"))) - .include(new Dependency("org.eclipse.jetty", "jetty-util", VersionNumber.parse("11.0.14"))) - .include(new Dependency("org.slf4j", "slf4j-api", VersionNumber.parse("2.0.5"))); + .include(new Dependency("org.eclipse.jetty", "jetty-server", Version.parse("11.0.14"))) + .include(new Dependency("org.eclipse.jetty.toolchain", "jetty-jakarta-servlet-api", Version.parse("5.0.2"))) + .include(new Dependency("org.eclipse.jetty", "jetty-http", Version.parse("11.0.14"))) + .include(new Dependency("org.eclipse.jetty", "jetty-io", Version.parse("11.0.14"))) + .include(new Dependency("org.eclipse.jetty", "jetty-util", Version.parse("11.0.14"))) + .include(new Dependency("org.slf4j", "slf4j-api", Version.parse("2.0.5"))); var set2 = new DependencySet() - .include(new Dependency("org.slf4j", "slf4j-simple", VersionNumber.parse("2.0.6"))) - .include(new Dependency("org.slf4j", "slf4j-api", VersionNumber.parse("2.0.6"))); + .include(new Dependency("org.slf4j", "slf4j-simple", Version.parse("2.0.6"))) + .include(new Dependency("org.slf4j", "slf4j-api", Version.parse("2.0.6"))); var set_union1 = new DependencySet(set1); set_union1.addAll(set2); diff --git a/src/test/java/rife/bld/dependencies/TestVersion.java b/src/test/java/rife/bld/dependencies/TestVersion.java new file mode 100644 index 0000000..e80d739 --- /dev/null +++ b/src/test/java/rife/bld/dependencies/TestVersion.java @@ -0,0 +1,73 @@ +/* + * Copyright 2001-2023 Geert Bevin (gbevin[remove] at uwyn dot com) + * Licensed under the Apache License, Version 2.0 (the "License") + */ +package rife.bld.dependencies; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +public class TestVersion { + @Test + void testParsing() { + assertEquals(Version.parse("1"), new VersionNumber(1, 0, 0, null)); + assertEquals(Version.parse("1.0"), new VersionNumber(1, 0, 0, null)); + assertEquals(Version.parse("1.0.0"), new VersionNumber(1, 0, 0, null)); + + assertEquals(Version.parse("1.2"), new VersionNumber(1, 2, 0, null)); + assertEquals(Version.parse("1.2.3"), new VersionNumber(1, 2, 3, null)); + + assertEquals(Version.parse("1-rc1-SNAPSHOT"), new VersionNumber(1, 0, 0, "rc1-SNAPSHOT")); + assertEquals(Version.parse("1.2-rc1-SNAPSHOT"), new VersionNumber(1, 2, 0, "rc1-SNAPSHOT")); + assertEquals(Version.parse("1.2.3-rc1-SNAPSHOT"), new VersionNumber(1, 2, 3, "rc1-SNAPSHOT")); + + assertEquals(Version.parse("11.22"), new VersionNumber(11, 22, 0, null)); + assertEquals(Version.parse("11.22.33"), new VersionNumber(11, 22, 33, null)); + assertEquals(Version.parse("11.22.33-eap"), new VersionNumber(11, 22, 33, "eap")); + + assertEquals(Version.parse("11.fortyfour"), new VersionNumber(11, 0, 0, "fortyfour")); + + assertEquals(Version.parse("1.0.0.0"), new VersionNumber(1, 0, 0, "0")); + assertEquals(Version.parse("1.0.0.0.0.0.0"), new VersionNumber(1, 0, 0, "0.0.0.0")); + assertEquals(Version.parse("1.2.3.4-rc1-SNAPSHOT"), new VersionNumber(1, 2, 3, "4-rc1-SNAPSHOT")); + assertEquals(Version.parse("1.2.3.4.rc1-SNAPSHOT"), new VersionNumber(1, 2, 3, "4.rc1-SNAPSHOT")); + + assertEquals(Version.parse("1.2.3_4"), new VersionNumber(1, 2, 0, "3_4")); + assertEquals(Version.parse("1.54b"), new VersionNumber(1, 0, 0, "54b")); + + assertEquals(Version.parse("2024-02"), new VersionNumber(2024, null, null, "02")); + assertEquals(Version.parse("2.0-05"), new VersionNumber(2, 0, null, "05")); + assertEquals(Version.parse("2024.02"), new VersionNumber(2024, null, null, "02", ".")); + assertEquals(Version.parse("2.0.05"), new VersionNumber(2, 0, null, "05", ".")); + + assertEquals(Version.parse("v3-rev20240514-2.0.0"), new VersionGeneric("v3-rev20240514-2.0.0")); + } + + @Test + void testInvalidParsed() { + assertEquals(Version.parse(null), VersionNumber.UNKNOWN); + assertEquals(Version.parse(""), VersionNumber.UNKNOWN); + assertEquals(Version.parse("foo"), new VersionGeneric("foo")); + assertEquals(Version.parse("1."), new VersionGeneric("1.")); + assertEquals(Version.parse("1.2.3-"), new VersionGeneric("1.2.3-")); + assertEquals(Version.parse("."), new VersionGeneric(".")); + assertEquals(Version.parse("_"), new VersionGeneric("_")); + assertEquals(Version.parse("-"), new VersionGeneric("-")); + assertEquals(Version.parse(".1"), new VersionGeneric(".1")); + assertEquals(Version.parse("a.1"), new VersionGeneric("a.1")); + assertEquals(Version.parse("1_2"), new VersionGeneric("1_2")); + assertEquals(Version.parse("1_2_2"), new VersionGeneric("1_2_2")); + } + + @Test + void testStringRepresentation() { + assertEquals(Version.parse("1.0").toString(), "1.0"); + assertEquals(Version.parse("1.2.3").toString(), "1.2.3"); + assertEquals(Version.parse("1.2.3-4").toString(), "1.2.3-4"); + assertEquals(Version.parse("1.2.3.4").toString(), "1.2.3.4"); + assertEquals(Version.parse("1-rc-1").toString(), "1-rc-1"); + assertEquals(Version.parse("1.2.3-rc-1").toString(), "1.2.3-rc-1"); + assertEquals(Version.parse("1.2.3.rc-1").toString(), "1.2.3.rc-1"); + } +} diff --git a/src/test/java/rife/bld/dependencies/TestVersionNumber.java b/src/test/java/rife/bld/dependencies/TestVersionNumber.java index ee133f4..60b389f 100644 --- a/src/test/java/rife/bld/dependencies/TestVersionNumber.java +++ b/src/test/java/rife/bld/dependencies/TestVersionNumber.java @@ -70,16 +70,16 @@ void testIsSnapshot() { void testInvalidParsed() { assertEquals(VersionNumber.parse(null), VersionNumber.UNKNOWN); assertEquals(VersionNumber.parse(""), VersionNumber.UNKNOWN); - assertEquals(VersionNumber.parse("foo"), new VersionGeneric("foo")); - assertEquals(VersionNumber.parse("1."), new VersionGeneric("1.")); - assertEquals(VersionNumber.parse("1.2.3-"), new VersionGeneric("1.2.3-")); - assertEquals(VersionNumber.parse("."), new VersionGeneric(".")); - assertEquals(VersionNumber.parse("_"), new VersionGeneric("_")); - assertEquals(VersionNumber.parse("-"), new VersionGeneric("-")); - assertEquals(VersionNumber.parse(".1"), new VersionGeneric(".1")); - assertEquals(VersionNumber.parse("a.1"), new VersionGeneric("a.1")); - assertEquals(VersionNumber.parse("1_2"), new VersionGeneric("1_2")); - assertEquals(VersionNumber.parse("1_2_2"), new VersionGeneric("1_2_2")); + assertEquals(VersionNumber.parse("foo"), VersionNumber.UNKNOWN); + assertEquals(VersionNumber.parse("1."), VersionNumber.UNKNOWN); + assertEquals(VersionNumber.parse("1.2.3-"), VersionNumber.UNKNOWN); + assertEquals(VersionNumber.parse("."), VersionNumber.UNKNOWN); + assertEquals(VersionNumber.parse("_"), VersionNumber.UNKNOWN); + assertEquals(VersionNumber.parse("-"), VersionNumber.UNKNOWN); + assertEquals(VersionNumber.parse(".1"), VersionNumber.UNKNOWN); + assertEquals(VersionNumber.parse("a.1"), VersionNumber.UNKNOWN); + assertEquals(VersionNumber.parse("1_2"), VersionNumber.UNKNOWN); + assertEquals(VersionNumber.parse("1_2_2"), VersionNumber.UNKNOWN); } @Test diff --git a/src/test/java/rife/bld/operations/TestDependencyTreeOperation.java b/src/test/java/rife/bld/operations/TestDependencyTreeOperation.java index 42b575c..4b5fe73 100644 --- a/src/test/java/rife/bld/operations/TestDependencyTreeOperation.java +++ b/src/test/java/rife/bld/operations/TestDependencyTreeOperation.java @@ -150,13 +150,13 @@ void testExecutionProvidedTest() .include(new Dependency("org.eclipse.jetty", "jetty-servlet", new VersionNumber(11,0,15)).exclude("*", "jetty-jakarta-servlet-api")) .include(new Dependency("org.apache.tomcat.embed", "tomcat-embed-core", new VersionNumber(10,1,12))) .include(new Dependency("org.apache.tomcat.embed", "tomcat-embed-jasper", new VersionNumber(10,1,12))) - .include(new Dependency("net.imagej", "ij", VersionNumber.parse("1.54d"))); + .include(new Dependency("net.imagej", "ij", Version.parse("1.54d"))); operation.dependencies().scope(Scope.test) .include(new Dependency("org.jsoup", "jsoup", new VersionNumber(1,16,1))) .include(new Dependency("jakarta.servlet", "jakarta.servlet-api", new VersionNumber(5,0,0))) .include(new Dependency("org.eclipse.jetty", "jetty-server", new VersionNumber(11,0,15)).exclude("*", "jetty-jakarta-servlet-api")) .include(new Dependency("org.eclipse.jetty", "jetty-servlet", new VersionNumber(11,0,15)).exclude("*", "jetty-jakarta-servlet-api")) - .include(new Dependency("net.imagej", "ij", VersionNumber.parse("1.54d"))); + .include(new Dependency("net.imagej", "ij", Version.parse("1.54d"))); operation.execute(); @@ -306,13 +306,13 @@ void testFromProjectProvidedTest() .include(new Dependency("org.eclipse.jetty", "jetty-servlet", new VersionNumber(11,0,15)).exclude("*", "jetty-jakarta-servlet-api")) .include(new Dependency("org.apache.tomcat.embed", "tomcat-embed-core", new VersionNumber(10,1,12))) .include(new Dependency("org.apache.tomcat.embed", "tomcat-embed-jasper", new VersionNumber(10,1,12))) - .include(new Dependency("net.imagej", "ij", VersionNumber.parse("1.54d"))); + .include(new Dependency("net.imagej", "ij", Version.parse("1.54d"))); project.dependencies().scope(Scope.test) .include(new Dependency("org.jsoup", "jsoup", new VersionNumber(1,16,1))) .include(new Dependency("jakarta.servlet", "jakarta.servlet-api", new VersionNumber(5,0,0))) .include(new Dependency("org.eclipse.jetty", "jetty-server", new VersionNumber(11,0,15)).exclude("*", "jetty-jakarta-servlet-api")) .include(new Dependency("org.eclipse.jetty", "jetty-servlet", new VersionNumber(11,0,15)).exclude("*", "jetty-jakarta-servlet-api")) - .include(new Dependency("net.imagej", "ij", VersionNumber.parse("1.54d"))); + .include(new Dependency("net.imagej", "ij", Version.parse("1.54d"))); var operation = new DependencyTreeOperation() .fromProject(project); @@ -405,13 +405,13 @@ void testFromProjectExtensions() .include(new Dependency("org.eclipse.jetty", "jetty-servlet", new VersionNumber(11,0,15)).exclude("*", "jetty-jakarta-servlet-api")) .include(new Dependency("org.apache.tomcat.embed", "tomcat-embed-core", new VersionNumber(10,1,12))) .include(new Dependency("org.apache.tomcat.embed", "tomcat-embed-jasper", new VersionNumber(10,1,12))) - .include(new Dependency("net.imagej", "ij", VersionNumber.parse("1.54d"))); + .include(new Dependency("net.imagej", "ij", Version.parse("1.54d"))); project.dependencies().scope(Scope.test) .include(new Dependency("org.jsoup", "jsoup", new VersionNumber(1,16,1))) .include(new Dependency("jakarta.servlet", "jakarta.servlet-api", new VersionNumber(5,0,0))) .include(new Dependency("org.eclipse.jetty", "jetty-server", new VersionNumber(11,0,15)).exclude("*", "jetty-jakarta-servlet-api")) .include(new Dependency("org.eclipse.jetty", "jetty-servlet", new VersionNumber(11,0,15)).exclude("*", "jetty-jakarta-servlet-api")) - .include(new Dependency("net.imagej", "ij", VersionNumber.parse("1.54d"))); + .include(new Dependency("net.imagej", "ij", Version.parse("1.54d"))); var operation = new DependencyTreeOperation() .fromProject(project); diff --git a/src/test/java/rife/bld/publish/TestMetadataBuilder.java b/src/test/java/rife/bld/publish/TestMetadataBuilder.java index 39f184e..d261b1b 100644 --- a/src/test/java/rife/bld/publish/TestMetadataBuilder.java +++ b/src/test/java/rife/bld/publish/TestMetadataBuilder.java @@ -41,7 +41,7 @@ void testMainInfoBuild() { .info(new PublishInfo() .groupId("com.example") .artifactId("myapp") - .version(VersionNumber.parse("1.2.3-SNAPSHOT"))); + .version(Version.parse("1.2.3-SNAPSHOT"))); assertEquals(""" @@ -100,7 +100,7 @@ void testCompleteBuild() { .info(new PublishInfo() .groupId("com.example") .artifactId("myapp") - .version(VersionNumber.parse("1.2.3-SNAPSHOT"))) + .version(Version.parse("1.2.3-SNAPSHOT"))) .otherVersions(List.of(new VersionNumber(6,0,1), new VersionNumber(3,0,2), new VersionNumber(1,0,3), new VersionNumber(3,0,2))) .updated(ZonedDateTime.of(2023, 3, 27, 8, 56, 17, 123, ZoneId.of("America/New_York"))); assertEquals(""" @@ -129,7 +129,7 @@ void testSnapshot() { .info(new PublishInfo() .groupId("com.example") .artifactId("myapp") - .version(VersionNumber.parse("1.2.3-SNAPSHOT"))) + .version(Version.parse("1.2.3-SNAPSHOT"))) .snapshot(ZonedDateTime.of(2023, 3, 27, 8, 56, 17, 123, ZoneId.of("America/New_York")), 5); assertEquals(""" @@ -156,7 +156,7 @@ void testSnapshotVersions() { .info(new PublishInfo() .groupId("com.example") .artifactId("myapp") - .version(VersionNumber.parse("1.2.3-SNAPSHOT"))) + .version(Version.parse("1.2.3-SNAPSHOT"))) .snapshot(moment, 5) .snapshotVersions(List.of( new SnapshotVersion("classifier1", "ext1", "123", moment2), @@ -207,7 +207,7 @@ void testLocalSnapshotVersions() { .info(new PublishInfo() .groupId("com.example") .artifactId("myapp") - .version(VersionNumber.parse("1.2.3-SNAPSHOT"))) + .version(Version.parse("1.2.3-SNAPSHOT"))) .snapshotLocal() .snapshotVersions(List.of( new SnapshotVersion("classifier1", "ext1", "123", moment2), diff --git a/src/test/java/rife/bld/publish/TestPomBuilder.java b/src/test/java/rife/bld/publish/TestPomBuilder.java index cf8a51d..16a427e 100644 --- a/src/test/java/rife/bld/publish/TestPomBuilder.java +++ b/src/test/java/rife/bld/publish/TestPomBuilder.java @@ -5,10 +5,7 @@ package rife.bld.publish; import org.junit.jupiter.api.Test; -import rife.bld.dependencies.Dependency; -import rife.bld.dependencies.DependencyScopes; -import rife.bld.dependencies.Scope; -import rife.bld.dependencies.VersionNumber; +import rife.bld.dependencies.*; import rife.tools.StringUtils; import java.io.File; @@ -50,7 +47,7 @@ void testMainInfoBuild() { .info(new PublishInfo() .groupId("com.example") .artifactId("myapp") - .version(VersionNumber.parse("1.2.3-SNAPSHOT")) + .version(Version.parse("1.2.3-SNAPSHOT")) .name("the thing") .description("the thing but longer") .url("https://the.thing")); @@ -227,7 +224,7 @@ void testFullInfoBuild() { .info(new PublishInfo() .groupId("com.example") .artifactId("myapp") - .version(VersionNumber.parse("1.2.3-SNAPSHOT")) + .version(Version.parse("1.2.3-SNAPSHOT")) .name("the thing") .description("the thing but longer") .url("https://the.thing") @@ -533,7 +530,7 @@ void testComplete() { .info(new PublishInfo() .groupId("com.example") .artifactId("myapp") - .version(VersionNumber.parse("1.2.3-SNAPSHOT")) + .version(Version.parse("1.2.3-SNAPSHOT")) .name("the thing") .description("the thing but longer") .url("https://the.thing")