I created a xml library to make the use of the standard library easier

Hey everybody,

as the title says, I created a library, to make operations with scala-xml just less frustrating.

There was a need in my daily programming work to manipulate xml-structures and the rule transformers were just unbelievably unwieldy, so I tried to write something that addresses that. The other thing I am trying to achieve is a simple saving mechanism. I don’t want to think about parsing, encoding or decoding objects, so I added functionality to basically safe and load any object.

Have there been libraries to do the same? Yes.

Though up till now they never really made anything easier and just increased the dependencies in the project.

The main goal was to make the use as easy as possible, without use of external libraries and with extensive code documentation.

The documentation hopefully helps others in creating similar things with macros or reflections.

Please check it out! ( …and if somebody knows how to use GitHub Packages, please instruct me. That would be helpful for this library)

Link to library:

Looks useful, but GitHub Packages might be a distraction. The usual way to make something available is through Maven, often using sbt-sonatype. (Yes, this is a mild hassle to set up, but once you have everything installed it’s pretty straightforward to use.)

1 Like

or even better, sbt-ci-release

2 Likes

I guess that would be the way to go. Thank you for the suggestions!
I am using Gradle at the moment, though. Would the switch to sbt be worthwile for this or should I look for an alternative Gradle option?

Gradle won’t let you cross compile for multiple scala versions, so probably worth switching.

4 Likes

That’s a good point. I will switch the build process, once I got a little more free time.
In the mean time, a new section for similar projects was added to scala/scala-xml.
So, if somebody knows some libraries similar to mine, they can be added there now.

1 Like

Hey there, I need a little advise. I am almost finished with releasing to maven, but there is still one thing getting in my way. Here is the error message I encounter:

[info] Finished bundle upload: D:\Programming\Repos\ezXML\target\sonatype-staging\0.1
[info] Closing staging repository [comgithubjulienst-1006] status:open, profile:com.github.julienst(324d1c9caef218) description: [sbt-sonatype] ezXML 0.1
[info] Activity name:open, started:2020-03-05T20:17:54.101Z, stopped:2020-03-05T20:18:51.040Z
[info] repositoryCreated: id:comgithubjulienst-1006, user:JulienSt, ip:77.13.5.222
[info] Activity name:close, started:2020-03-05T20:19:31.291Z
[info]   Evaluate: id:5e9e8e6f8d20a3, rule:sources-staging
[info]   Evaluate: no-traversal-paths-in-archive-file
[info]     Passed: no-traversal-paths-in-archive-file
[info]   Evaluate: pom-staging
[info] The close process is in progress ...
[info]     Passed: pom-staging
[info]   Evaluate: profile-target-matching-staging
[info] The close process is in progress ...
[info]     Failed: profile-target-matching-staging, failureMessage:Profile target mismatch: /JulienSt/ezxml-extension_2.13/0.1/ezxml-extension_2.13-0.1.pom
[info]   Evaluate: checksum-staging
[info]     Passed: checksum-staging
[info]   Evaluate: javadoc-staging
[error] Failed to close the repository
[error] Activity name:close, started:2020-03-05T20:19:31.291Z
[error]     Failed: profile-target-matching-staging, failureMessage:Profile target mismatch: /JulienSt/ezxml-extension_2.13/0.1/ezxml-extension_2.13-0.1.pom
[error] java.lang.Exception: Failed to close the repository

My sonatype ticket can be found here: https://issues.sonatype.org/browse/OSSRH-55603

As mentioned there, something seems to be wrong with my group Id. As the output shows mismatch: /JulienSt/ezxml- ... and not something with github included.

Does somebody know whats happening here?

And this is the build.sbt

name := "ezXML"

ThisBuild / organization := "com.github.julienst"
ThisBuild / version := "0.1"
ThisBuild / scalaVersion := "2.13.1"
ThisBuild / libraryDependencies := Seq (
    "org.scala-lang.modules" %% "scala-xml" % "1.2.0", // https://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml
    "junit" % "junit" % "4.12" % Test, // https://mvnrepository.com/artifact/junit/junit
    "org.scalatest" %% "scalatest" % "3.1.1" % Test // https://mvnrepository.com/artifact/org.scalatest/scalatest
    )

lazy val core = (project in file("core")).settings(name := "ezxml.core")
lazy val extension = (project in file("extension")).dependsOn(core).settings(
    name := "ezxml.extension",
    scalacOptions += "-Ymacro-annotations",
    libraryDependencies += "org.scala-lang" % "scala-reflect" % "2.13.1", // https://mvnrepository.com/artifact/org.scala-lang/scala-reflect,
)

lazy val root = (project in file(".")).aggregate(core, extension)


ThisBuild / publishTo := sonatypePublishToBundle.value
ThisBuild / sonatypeProfileName := "JulienSt"
ThisBuild / licenses := Seq("MIT" -> url("https://raw.githubusercontent.com/JulienSt/ezXML/master/LICENSE"))
ThisBuild / publishMavenStyle := true
ThisBuild / homepage := Some(url("https://github.com/julienst/ezxml"))
ThisBuild / scmInfo := Some(
    ScmInfo(
        url("https://github.com/julienst/ezxml"),
        "scm:https://github.com/JulienSt/ezXML.git"
        )
    )
ThisBuild / developers := List(
    Developer(id="com.github.julienst", name="Julien Stengel", email="julien.stengel@gmail.com", url=url("https://github.com/julienst"))
)

I already switched out the scm, groupId, Devloper(id=), and sonarTypeProfileName, but nothing seems to matter.
After asking the same question in the sbt-sonatype-repo and in users.scala and still not knowing what to do, I thought I should ask where the solution was given.
So, if somebody knows whats up, please let me know.