m-shade-p takes the current project artifact as its input [1], so you can
configure it in the m-jar-p:
https://maven.apache.org/plugins/maven-jar-plugin/examples/manifest-customization.html

[1]
https://github.com/apache/maven-plugins/blob/maven-shade-plugin-3.1.0/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java#L404

On Wed, Aug 30, 2017 at 1:31 PM Daniel Persson <mailto.wo...@gmail.com>
wrote:

> Hi, Thomas.
>
> You're probably right. Sadly I can't find in the documentation how to add
> the main class and version information into your manifest file using the
> shade plugin.
>
> Best regards
> Daniel
>
> On Wed, Aug 30, 2017 at 1:24 PM, Daniel Persson <mailto.wo...@gmail.com>
> wrote:
>
> > Hi, Robert.
> >
> > I think I know what is happening here. The shaded jar replaces the
> > original jar the last thing that is done in the execution.
> > Sadly it's done only for the regular jar. Not the jar-with-dependencies
> > one.
> >
> > And yes I've updated the versions in the new build file. So assembly
> > plugin and shade plugin both run with 3.1.0.
> >
> > Best regards
> >
> > Daniel
> >
> > On Wed, Aug 30, 2017 at 12:15 PM, Thomas Broyer <t.bro...@gmail.com>
> > wrote:
> >
> >> You're using both m-assembly-p's jar-with-dependencies and m-shade-p,
> >> could
> >> it be a conflict between them? (or possibly you don't look at the
> correct
> >> JAR)
> >> If you use m-shade-p, you don't need m-assembly-p's
> jar-with-dependencies;
> >> m-shade-p does the same thing, better, and does more (class renaming,
> >> merging service resources, etc.)
> >>
> >> On Wed, Aug 30, 2017 at 11:54 AM Daniel Persson <mailto.wo...@gmail.com
> >
> >> 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.Appe
> >> ndingTransformer">
> >> >
> >> >
> <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 <
> rfscho...@apache.org>
> >> > wrote:
> >> >
> >> > > On Wed, 30 Aug 2017 08:52:45 +0200, Daniel Persson <
> >> > mailto.wo...@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-unsubscr...@maven.apache.org
> >> > > For additional commands, e-mail: users-h...@maven.apache.org
> >> > >
> >> > >
> >> >
> >>
> >
> >
>

Reply via email to