maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Persson <mailto.wo...@gmail.com>
Subject Re: There must be a better way.
Date Wed, 30 Aug 2017 09:53:56 GMT
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 <rfscholte@apache.org>
wrote:

> On Wed, 30 Aug 2017 08:52:45 +0200, Daniel Persson <mailto.woden@gmail.com>
> 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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message