someuser
someuser

Reputation: 21

XML Processing with Java 11 with module-info in external library (dom4j problem)

While migrating a project from java 8 to java 11 using the java module system we noticed two warnings due to used library dom4j (version 2.1.3).

Problem

  1. "Name of automatic module ´dom4j´ is unstable, it is derived from the module´s file name." (Eclipse 2020-09)
  2. "Required filename-based automodule detected: [dom4j-2.1.3.jar]. Please don´t publish this project to a public artifact repository!" (Maven 3.6.0)

Situation

As far i can see the developers of dom4j are aware of this problem: https://github.com/dom4j/dom4j/issues/67

Since the issue is over 1 year old, still open, and the last commit to master branch is 7 month old we wan´t to move away from dom4j (sadly, i really liked dom4j) to a newer library. We realy want to use the new module system of Java and don´t want to ignore those warnings.

Question

Could you recommend a "modern" Java-9 module system aware library for xml processing? We use mainly simple stuff like reading/parsing, writing and pretty printing. An Apache-2.0 License would be nice but is not a requirement.

My resaerch currenly revealed https://github.com/FasterXML/aalto-xml which is Apache-2.0 License and seems to contain a Java 9 Module definition. Could you recomment Aalto or any other library for usage with the java module system?

Reproducability

The problem could easily be reproduced using a simple pom.xml including a dependency to

<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.3.1</version>

together with mavens build plugin

<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
 <release>11</release>
 <encoding>utf-8</encoding>...

and a module-info.java

module dom4jproblem {
  exports mypackage;
  
  requires dom4j;
}

Upvotes: 1

Views: 588

Answers (0)

Related Questions