Hi Daniel,
that would be bug, both should work.
ServiceResourceTransformer would be the preferred one in this case,
because it is classname aware, in case you want to do relocation as well.
Are you using the most recent version of the plugin?
If so, then make a small reproducable project and file an issue[1]
I would be surprised though, I consider this as basic functionality and
would have expected more complaints if this was not working.
Robert
[1] https://issues.apache.org/jira/projects/MSHADE
On Wed, 30 Aug 2017 11:53:56 +0200, Daniel Persson
<[email protected]> wrote:
Hi Robert.
Thank you for the prompt response.
I've tried that transformer and I also tried to use this
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/services/javax.imageio.spi.ImageReaderSpi</resource>
</transformer>
Sadly it doesn't work for me.
The result is always the same. The first service file is the only one
that
will be present in the output.
So what I want to accomplice is that the output has a ImageReaderSpi file
that has content from all the jar files individual ImageReaderSpi in my
project.
jai-imageio-jpeg2000:
com.github.jaiimageio.jpeg2000.impl.J2KImageReaderSpi
jai-imageio-core:
com.github.jaiimageio.impl.plugins.wbmp.WBMPImageReaderSpi
com.github.jaiimageio.impl.plugins.bmp.BMPImageReaderSpi
com.github.jaiimageio.impl.plugins.pcx.PCXImageReaderSpi
com.github.jaiimageio.impl.plugins.pnm.PNMImageReaderSpi
com.github.jaiimageio.impl.plugins.raw.RawImageReaderSpi
com.github.jaiimageio.impl.plugins.tiff.TIFFImageReaderSpi
and so on.
Expected output:
com.github.jaiimageio.jpeg2000.impl.J2KImageReaderSpi
com.github.jaiimageio.impl.plugins.wbmp.WBMPImageReaderSpi
com.github.jaiimageio.impl.plugins.bmp.BMPImageReaderSpi
com.github.jaiimageio.impl.plugins.pcx.PCXImageReaderSpi
com.github.jaiimageio.impl.plugins.pnm.PNMImageReaderSpi
com.github.jaiimageio.impl.plugins.raw.RawImageReaderSpi
com.github.jaiimageio.impl.plugins.tiff.TIFFImageReaderSpi
Actual output:
com.github.jaiimageio.jpeg2000.impl.J2KImageReaderSpi
Best regards
Daniel
On Wed, Aug 30, 2017 at 11:24 AM, Robert Scholte <[email protected]>
wrote:
On Wed, 30 Aug 2017 08:52:45 +0200, Daniel Persson
<[email protected]>
wrote:
Hi, everyone.
I maintain a java tool that uses all the image libraries under the sun.
And
they all expose the javax.imageio.spi.ImageReaderSpi service.
Because it's hard to actually merge all the service definition files
I've
opted to merge them manually and add them into my META-INF/services
directory.
What's so hard?
Have you tried using https://maven.apache.org/plugi
ns/maven-shade-plugin/examples/resource-transformers.html#Se
rvicesResourceTransformer ?
Robert
Then I use maven shade plugin to exclude this file from all packages
and
then add it back with resources definition.
This works 25% of the time and other times I have to open the jar file
and
replace this file manually. Because this is a manual step I forget to
do
this in some releases so I really hope there is a better way to do
this.
I've added the build definition part of the pom file to the link below.
https://pastebin.com/bGy3bvm0
Hope you have a creative solution to this problem. And thank you for a
great tool that really simplified our build process.
Best regards
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]