Skip to content

Commit

Permalink
Handle semver metadata in version string
Browse files Browse the repository at this point in the history
Update how version is parsed for pom files in the jar file
to dependency logic to to cater for characters that are valid
in version strings but encoded in the file path.
For example, "+" which is used for semver metadata, encoded as
"%2B".

Before this change 7.2.27+33-04a1ea9e-SNAPSHOT version string
was not handled consistently and would result in different
values in the declared/used compile dependencies.

Fixes: cb372#110
  • Loading branch information
andyjayne committed Nov 30, 2023
1 parent f64a275 commit 9334a09
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/scala/explicitdeps/BoringStuff.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ object BoringStuff {
val rawName = (xml \ "artifactId").text

// We use the parent dir to get the version because it's sometimes not present in the pom file
val version = file.getParentFile.getName
// We use URL decoder to cater for characters that are valid in version strings but encoded
// in the file path, such as "+" used for semver metadata, encoded as "%2B"
val version = java.net.URLDecoder.decode(
file.getParentFile.getName,
java.nio.charset.Charset.forName("utf8")
)

val (name, crossVersion) = parseModuleName(scalaVersion)(rawName)

Expand Down

0 comments on commit 9334a09

Please sign in to comment.