2

When I set up a maven project using Apache fop and Java 11 I get warnings and a NullPointerException with maven-compiler-plugin 3.8.0.

The used archetype is working fine with Java 11 to quickly create a desktop application, but only if I do not add the dependency to fop-2.3. (I also wonder how it is possible that the same Java code works fine in mvn test but fails when adding the fop dependency.)

adding

    <dependency>
        <groupId>org.apache.xmlgraphics</groupId>
        <artifactId>fop</artifactId>
        <version>2.3</version>
    </dependency>

to pom.xml and running with mvn test leads to

[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ checkXslt ---
[WARNING] Can't extract module name from batik-script-1.10.jar: Provider class org.apache.batik.bridge.RhinoInterpreterFactory not in module
[WARNING] Can't extract module name from xalan-2.7.2.jar: Provider class org.apache.bsf.BSFManager not in module

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project checkXslt: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile failed. NullPointerException -> [Help 1]

I wonder if there is a pom.xml using fop dependency and compiling for Java 11.

Naman
  • 27,789
  • 26
  • 218
  • 353
ngong
  • 754
  • 1
  • 8
  • 23
  • could you run the command with `-X` and share the debug log for the `NullPointerException` as well. – Naman Feb 13 '19 at 01:59
  • FYI, the dependency just works fine for me in a standalone project. So seemingly something else could be the cause to the exception you're facing. – Naman Feb 13 '19 at 04:49
  • In your project, are you using modulepath or classpath? Do you have a `module-info.java` file in your project? If you do, trying removing it and running with classpath instead and see if the error persists. – prunge Feb 13 '19 at 06:19
  • can you update compiler plugin to this and try ` org.apache.maven.plugins maven-compiler-plugin 3.8.0 11 ` – dkb Feb 13 '19 at 06:56
  • @nullpointer: [here](https://spaces.hightail.com/space/vlxxF9BPgb) I've uploaded the log file. – ngong Feb 13 '19 at 07:23
  • Also try to update surefire plugin from `3.0.0-M1` to `3.0.0-M6` since this bug: maven-surefire-report-plugin fails on JDK 11: https://issues.apache.org/jira/browse/SUREFIRE-1613 is fixed in `3.0.0-M3` – dkb Feb 13 '19 at 07:46
  • Similar bug is already reported and fixed: https://jira.apache.org/jira/browse/MCOMPILER-355 – dkb Feb 13 '19 at 07:49
  • @dkb thank you. On maven central there is 3.0.0-M3, that should do. Yes, I was part of MCOMPILER-360 and did my best to help, but gave up at that time, because I am not an expert on all these. Today I pulled maven-compiler-plugin from github, installed it to 3.8.1-SNAPSHOT, but as in September last year, the problem remained. Now I am hoping for a link or so, telling how to use fop with maven and Java11 - assuming that the problem is on my site. – ngong Feb 13 '19 at 19:23

3 Answers3

1

The nullpointer problem disappears if using the trunk of fop 2.4.0-SNAPSHOT. Going back to 2.3 gives the nullpointer again.

Note that for fop just the dependency has been added to pom.xml. It has not been used yet in the java source code.

The warnings remain.

ngong
  • 754
  • 1
  • 8
  • 23
0

have you tried

 <dependency>
            <groupId>org.apache.xmlgraphics</groupId>
            <artifactId>fop</artifactId>
            <version>2.3</version>
            <exclusions>
                <exclusion>
                  <groupId>xalan</groupId>
                  <artifactId>serializer</artifactId>          
                </exclusion>
                 <exclusion>
                  <groupId>xalan</groupId>
                  <artifactId>xalan</artifactId>          
                </exclusion>
              </exclusions> 
        </dependency>
  • the nullpointer exception is still there, Andreas. However the warning about xalan is gone. May I exclude batik-script as well, and if so: how – ngong Apr 05 '19 at 13:05
0

I started to set up a project using FOP 2.3; I used a module-info.java containing:

requires fop;
requires avalon.framework.api;
requires avalon.framework.impl;

However, ultimately I had to defer, owing to avalon splitting packages.

That particular problem will be gone when FOP 2.4 is released: https://github.com/apache/fop/commit/bd7d5048785c691e6e3e152af10805f3127b760d

The Xalan problem I had addressed earlier by modularising it myself:- https://github.com/plutext/xalan-j/tree/Plutext_Java11_Repackaged_Docx4j

JasonPlutext
  • 15,352
  • 4
  • 44
  • 84