Is there some help about fop?
-------- Forwarded Message --------
Subject: Re: How to use fop with Java 21
Date: Thu, 5 Sep 2024 12:26:09 +0200
From: Csaba Nánai <szea...@gmail.com>
To: Rolf Schumacher <r...@august.de>
Hi, Rolf
Sorry, but i'm not at home in JPMS and Java 21 capabilities.
Please send this mail to the list for community help.
Best luck
Rolf Schumacher <r...@august.de> ezt írta (időpont: 2024. szept. 5., Cs,
8:11):
Thank you for responding Csaba.
Years ago i did me a utility module, amoung others hosting
operations to help with xslt and fop. fop 2.8 was the latest version
that worked. Every year I am trying to upgrade to 2.9, hoping that
fop can be used seemlessly with JPMS, now Java 21. I did a new trial
these days and failed again.
The pom.xml of the utility module draws the dependencies
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop-core</artifactId>
<version>2.9</version>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>xmlgraphics-commons</artifactId>
<version>2.9</version>
</dependency>
The application which depends ot the util module copies all
dependencies to a "lib" folder:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.8.0</version>
<executions>
<execution>
<id>copy-dependencies-to-lib</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>target/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
If I run the application by
java -p fctr-0.0.1-SNAPSHOT.jar:lib -m
eu.ngong.fctr/eu.ngong.fctr.App <http://eu.ngong.fctr.App> RoS fctr
I get the error
Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Modules fop.core and fop.util
export package org.apache.fop.util.text to module qdox
I spend days to manually sort out all the jar files in "lib" folder
to warrant that each module can be found only ones. That work
finally became successful and the application starts, but fop is
missing some classes. If I put the jar files back hosting those
classes (lots of work!) I get again the error of doubled packages.
It would be too much to reduce the application to just isolate the
problem. Therefore I am looking for an example with this properties:
- Java 21
- maven
- fop 2.9
- generating a PDF from an xslfo file.
to try to build up from there and find my problem. Or: I just wait
another year, stick to non-JPMS fop 2.8.
BR
Rolf
p.s. ChatGPT does not find such an example.
On 9/4/24 12:34, Csaba Nánai wrote:
Hi Rolf,
Did you have a compiling issue or runtime error?
Please let us know more!
Please send error messages and stack trace, and a minimal
reproducible example!
Best regards, Csaba
Rolf Schumacher <r...@august.de> ezt írta (időpont: 2024. szept.
3., K, 18:40):
Dear fop specialists,
some time ago I used to use fop something like shown below (I
hope the formatting stays constant).
Now I was trying to do so with maven, Java-21 and fop 2.9 and
failed.
Is there an example program, e.g. on github, how to use fop
2.9, including the pom.xml and the module-info.java?
=====
FopFactoryBuilderbuilder=newFopFactoryBuilder(basePath.toUri())
.setPageHeight("297mm")
.setPageWidth("210mm");
FopFactoryfopFactory=builder.build();
out=newBufferedOutputStream(Files.newOutputStream(r));
Fopfop=fopFactory.newFop(MimeConstants.MIME_PDF,out);
Transformertransformer=TransformerFactory.newInstance().newTransformer();
Sourcesrc=newStreamSource(fo.toFile());
Resultres=newSAXResult(fop.getDefaultHandler());
transformer.transform(src,res);
out.close();
=====
mit freundlichen Grüße, Best Regards
Rolf
mit freundlichen Grüße, Best Regards
Rolf