mojohaus / xml-maven-plugin

XML Maven Plugin
https://www.mojohaus.org/xml-maven-plugin/
Apache License 2.0
23 stars 21 forks source link

Transform goal fails without internet connection #11

Closed solomax closed 7 years ago

solomax commented 8 years ago

Hello,

we are using transform goal to generate some documentation files Yesterday I noticed generation fails with weird exception in case there is no internet connection:

mvn clean install -o was used here is the exception details

[INFO] --- xml-maven-plugin:1.0.1:transform (generate-errors-doc) @ openmeetings-server ---
[INFO] Transforming file: /home/solomax/work/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/languages/errorvalues.xml
ERROR:  'java.sun.com'
ERROR:  'File not found: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: java.sun.com'
ERROR:  'com.sun.org.apache.xalan.internal.xsltc.TransletException: java.io.FileNotFoundException: file:/home/solomax/work/openmeetings/application/branches/3.2.x/openmeetings-server//../openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.properties.xml'

Everything works as expected in case there is active internet connection

Please let me know if you need sample project and/or any additional details Thanks a lot for your help

khmarbaise commented 8 years ago

Do you have an example project to reproduce this?

solomax commented 8 years ago

sure :) https://github.com/solomax/xml-transform

solomax commented 8 years ago

I'm using Oracle java 8 latest Maven 3.3.9 Ubuntu 16.04 all updates

jochenw commented 7 years ago

Okay, reproducable using the given example project. Thank you!

jochenw commented 7 years ago

I was able to reduce your problem to the following piece of Java code. As you can see, this is in no way related to the xml-maven-plugin, but due to using Xalan. As a consequence, I suggest that you continue by submitting a Xalan issue. I'll be closing the current issue.

        final File xmlFile =  new File("src/test/resources/gh11/errorvalues.xml");
        if (!xmlFile.isFile()) {
            throw new IllegalStateException("XML File not found: " + xmlFile);
        }
        final File xslFile =  new File("src/test/resources/gh11/errortable.xsl");
        if (!xmlFile.isFile()) {
            throw new IllegalStateException("XSL File not found: " + xslFile);
        }
        final File appDir = new File("src/test/resources/gh11/app");
        if (!appDir.isDirectory()) {
            throw new IllegalStateException("App dir not found: " + appDir);
        }
        final TransformerFactory tf = TransformerFactory.newInstance();
        final Transformer t = tf.newTransformer(new StreamSource(xslFile));
        t.setParameter("languagesDir", appDir.getAbsolutePath());
        final OutputStream os = System.out;
        t.transform(new StreamSource(xmlFile), new StreamResult(os));
solomax commented 7 years ago

Thanks for investigation Unfortunately Xalan seems to be not maintained :( Latest release 2014, latest activity in user@ mailing list 2012 ....

jochenw commented 7 years ago

Sorry, can't help you with that. Try using another XSL Library?

solomax commented 7 years ago

xml-maven-plugin has option to set XSL Library?

jochenw commented 7 years ago

Unsure. But that is something I might help with.

jochenw commented 7 years ago

See http://www.mojohaus.org/xml-maven-plugin/examples/transform-saxon.html

solomax commented 7 years ago

Thanks a lot! Will try it and report back :)

solomax commented 7 years ago

Seems to work as expected Thanks a lot!