You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ben Tatham <be...@nanometrics.ca> on 2017/03/08 22:05:21 UTC

uber source jar

Is there a well-known way to create an uber source jar? In other words, a
jar of all the source code for a project and all its dependencies (or at
least those that have a -sources.jar)?

I've looked into doing it with the maven-assembly-plugin, but using a
dependencySet with includes of *.*.*.sources.* doesn't work because those
are not actually dependencies of the project.

I perhaps could look into using dependency:sources, and specifying an
alternate repository to download them into (in target, eg), and then use a
fileSet of maven-assembly-plugin to add them all, but there must be a
better way...

Thanks,
Ben
-- 
-- 
Ben Tatham
Software Architect

*Nano**metrics* *Inc.*

Ottawa * I*  Calgary  *I*  Houston  *I*  Beijing

T: +1 613 505 5065  *I*  bentatham@nanometrics.ca
 www.nanometrics.ca  *I  *www.microseismicmonitoring.com

This message is intended exclusively for the individual or entity to which
it is addressed. This communication may contain information that is
proprietary, privileged, confidential or otherwise legally exempt from
disclosure. If you are not the named addressee, or have been inadvertently
and erroneously referenced in the address line, you are not authorized to
read, print, retain, copy or disseminate this message or any part of it. If
you have received this message in error, please notify the sender
immediately by e-mail and delete all copies of the message.

Re: uber source jar

Posted by Ben Tatham <be...@nanometrics.ca>.
For those who find this post in the future, you can also use the
maven-shade-plugin to create an uber-source jar, but it also creates an
potentially unwanted binder jar too...

see
http://stackoverflow.com/questions/42683048/how-do-i-create-an-uber-source-jar-with-maven
for
details.

On Thu, Mar 9, 2017 at 10:55 AM Ben Tatham <be...@nanometrics.ca> wrote:

> jarjar doesn't have that option as far as I can tell...
>
> What I did find was this in the maven-dependency-plugin:
> https://maven.apache.org/plugins/maven-dependency-plugin/examples/using-dependencies-sources.html
>
> So if I do that, and then run a maven-assembly-plugin referencing the
> unpacked files, I can do it in two steps.
>
>     <fileSet>
>       <directory>${project.build.directory}/sources</directory>
>       <outputDirectory>.</outputDirectory>
>     </fileSet>
>
> And then I get my uber source jar...
>
> In theory, I could wrap this up in my own plugin using mojo-executor to
> make it single step, and single declaration in my pom.  Or write something
> that does it all in a custom plugin natively.    If I were to do that, not
> sure if it would belong in maven-sources-plugin or maven-dependency-plugin
> to which I could contribute.
>
> Thanks everyone for trying.
>
>
> On Wed, Mar 8, 2017 at 9:03 PM M. Justin <mj...@gmail.com> wrote:
>
> I haven't used it myself, but there is this maven plugin
> <https://sonatype.github.io/jarjar-maven-plugin/> for JarJar Links.
>
> On Wed, Mar 8, 2017 at 4:34 PM, Curtis Rueden <ct...@wisc.edu> wrote:
>
> > Hi Ben,
> >
> > > Is there a well-known way to create an uber source jar? In other
> > > words, a jar of all the source code for a project and all its
> > > dependencies (or at least those that have a -sources.jar)?
> >
> > Good question. The way I have done it is to explicitly enumerate all the
> > sources classifier JARs in a profile [1]. This is of course very yucky,
> and
> > I would love to know if there is a better way.
> >
> > I definitely suggest you avoid uber-JARs (with or without embedded
> sources)
> > when possible, though; for a rationale, see http://imagej.net/Uber-JAR.
> >
> > Regards,
> > Curtis
> >
> > [1] https://github.com/imagej/imagej/blob/imagej-2.0.0-rc-
> > 59/pom.xml#L395-L626
> >
> > --
> > Curtis Rueden
> > LOCI software architect - https://loci.wisc.edu/software
> > ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
> >
> >
> > On Wed, Mar 8, 2017 at 4:05 PM, Ben Tatham <be...@nanometrics.ca>
> > wrote:
> >
> > > Is there a well-known way to create an uber source jar? In other
> words, a
> > > jar of all the source code for a project and all its dependencies (or
> at
> > > least those that have a -sources.jar)?
> > >
> > > I've looked into doing it with the maven-assembly-plugin, but using a
> > > dependencySet with includes of *.*.*.sources.* doesn't work because
> those
> > > are not actually dependencies of the project.
> > >
> > > I perhaps could look into using dependency:sources, and specifying an
> > > alternate repository to download them into (in target, eg), and then
> use
> > a
> > > fileSet of maven-assembly-plugin to add them all, but there must be a
> > > better way...
> > >
> > > Thanks,
> > > Ben
> > > --
> > > --
> > > Ben Tatham
> > > Software Architect
> > >
> > > *Nano**metrics* *Inc.*
> > >
> > > Ottawa * I*  Calgary  *I*  Houston  *I*  Beijing
> > >
> > > T: +1 613 505 5065 <(613)%20505-5065>  *I*  bentatham@nanometrics.ca
> > >  www.nanometrics.ca  *I  *www.microseismicmonitoring.com
> > >
> > > This message is intended exclusively for the individual or entity to
> > which
> > > it is addressed. This communication may contain information that is
> > > proprietary, privileged, confidential or otherwise legally exempt from
> > > disclosure. If you are not the named addressee, or have been
> > inadvertently
> > > and erroneously referenced in the address line, you are not authorized
> to
> > > read, print, retain, copy or disseminate this message or any part of
> it.
> > If
> > > you have received this message in error, please notify the sender
> > > immediately by e-mail and delete all copies of the message.
> > >
> >
>
> --
> --
> Ben Tatham
> Software Architect
>
> *Nano**metrics* *Inc.*
>
> Ottawa * I*  Calgary  *I*  Houston  *I*  Beijing
>
> T: +1 613 505 5065  *I*  bentatham@nanometrics.ca
>  www.nanometrics.ca  *I  *www.microseismicmonitoring.com
>
> This message is intended exclusively for the individual or entity to which
> it is addressed. This communication may contain information that is
> proprietary, privileged, confidential or otherwise legally exempt from
> disclosure. If you are not the named addressee, or have been inadvertently
> and erroneously referenced in the address line, you are not authorized to
> read, print, retain, copy or disseminate this message or any part of it. If
> you have received this message in error, please notify the sender
> immediately by e-mail and delete all copies of the message.
>
-- 
-- 
Ben Tatham
Software Architect

*Nano**metrics* *Inc.*

Ottawa * I*  Calgary  *I*  Houston  *I*  Beijing

T: +1 613 505 5065  *I*  bentatham@nanometrics.ca
 www.nanometrics.ca  *I  *www.microseismicmonitoring.com

This message is intended exclusively for the individual or entity to which
it is addressed. This communication may contain information that is
proprietary, privileged, confidential or otherwise legally exempt from
disclosure. If you are not the named addressee, or have been inadvertently
and erroneously referenced in the address line, you are not authorized to
read, print, retain, copy or disseminate this message or any part of it. If
you have received this message in error, please notify the sender
immediately by e-mail and delete all copies of the message.

Re: uber source jar

Posted by Ben Tatham <be...@nanometrics.ca>.
jarjar doesn't have that option as far as I can tell...

What I did find was this in the maven-dependency-plugin:
https://maven.apache.org/plugins/maven-dependency-plugin/examples/using-dependencies-sources.html

So if I do that, and then run a maven-assembly-plugin referencing the
unpacked files, I can do it in two steps.

    <fileSet>
      <directory>${project.build.directory}/sources</directory>
      <outputDirectory>.</outputDirectory>
    </fileSet>

And then I get my uber source jar...

In theory, I could wrap this up in my own plugin using mojo-executor to
make it single step, and single declaration in my pom.  Or write something
that does it all in a custom plugin natively.    If I were to do that, not
sure if it would belong in maven-sources-plugin or maven-dependency-plugin
to which I could contribute.

Thanks everyone for trying.


On Wed, Mar 8, 2017 at 9:03 PM M. Justin <mj...@gmail.com> wrote:

> I haven't used it myself, but there is this maven plugin
> <https://sonatype.github.io/jarjar-maven-plugin/> for JarJar Links.
>
> On Wed, Mar 8, 2017 at 4:34 PM, Curtis Rueden <ct...@wisc.edu> wrote:
>
> > Hi Ben,
> >
> > > Is there a well-known way to create an uber source jar? In other
> > > words, a jar of all the source code for a project and all its
> > > dependencies (or at least those that have a -sources.jar)?
> >
> > Good question. The way I have done it is to explicitly enumerate all the
> > sources classifier JARs in a profile [1]. This is of course very yucky,
> and
> > I would love to know if there is a better way.
> >
> > I definitely suggest you avoid uber-JARs (with or without embedded
> sources)
> > when possible, though; for a rationale, see http://imagej.net/Uber-JAR.
> >
> > Regards,
> > Curtis
> >
> > [1] https://github.com/imagej/imagej/blob/imagej-2.0.0-rc-
> > 59/pom.xml#L395-L626
> >
> > --
> > Curtis Rueden
> > LOCI software architect - https://loci.wisc.edu/software
> > ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
> >
> >
> > On Wed, Mar 8, 2017 at 4:05 PM, Ben Tatham <be...@nanometrics.ca>
> > wrote:
> >
> > > Is there a well-known way to create an uber source jar? In other
> words, a
> > > jar of all the source code for a project and all its dependencies (or
> at
> > > least those that have a -sources.jar)?
> > >
> > > I've looked into doing it with the maven-assembly-plugin, but using a
> > > dependencySet with includes of *.*.*.sources.* doesn't work because
> those
> > > are not actually dependencies of the project.
> > >
> > > I perhaps could look into using dependency:sources, and specifying an
> > > alternate repository to download them into (in target, eg), and then
> use
> > a
> > > fileSet of maven-assembly-plugin to add them all, but there must be a
> > > better way...
> > >
> > > Thanks,
> > > Ben
> > > --
> > > --
> > > Ben Tatham
> > > Software Architect
> > >
> > > *Nano**metrics* *Inc.*
> > >
> > > Ottawa * I*  Calgary  *I*  Houston  *I*  Beijing
> > >
> > > T: +1 613 505 5065 <(613)%20505-5065>  *I*  bentatham@nanometrics.ca
> > >  www.nanometrics.ca  *I  *www.microseismicmonitoring.com
> > >
> > > This message is intended exclusively for the individual or entity to
> > which
> > > it is addressed. This communication may contain information that is
> > > proprietary, privileged, confidential or otherwise legally exempt from
> > > disclosure. If you are not the named addressee, or have been
> > inadvertently
> > > and erroneously referenced in the address line, you are not authorized
> to
> > > read, print, retain, copy or disseminate this message or any part of
> it.
> > If
> > > you have received this message in error, please notify the sender
> > > immediately by e-mail and delete all copies of the message.
> > >
> >
>
-- 
-- 
Ben Tatham
Software Architect

*Nano**metrics* *Inc.*

Ottawa * I*  Calgary  *I*  Houston  *I*  Beijing

T: +1 613 505 5065  *I*  bentatham@nanometrics.ca
 www.nanometrics.ca  *I  *www.microseismicmonitoring.com

This message is intended exclusively for the individual or entity to which
it is addressed. This communication may contain information that is
proprietary, privileged, confidential or otherwise legally exempt from
disclosure. If you are not the named addressee, or have been inadvertently
and erroneously referenced in the address line, you are not authorized to
read, print, retain, copy or disseminate this message or any part of it. If
you have received this message in error, please notify the sender
immediately by e-mail and delete all copies of the message.

Re: uber source jar

Posted by "M. Justin" <mj...@gmail.com>.
I haven't used it myself, but there is this maven plugin
<https://sonatype.github.io/jarjar-maven-plugin/> for JarJar Links.

On Wed, Mar 8, 2017 at 4:34 PM, Curtis Rueden <ct...@wisc.edu> wrote:

> Hi Ben,
>
> > Is there a well-known way to create an uber source jar? In other
> > words, a jar of all the source code for a project and all its
> > dependencies (or at least those that have a -sources.jar)?
>
> Good question. The way I have done it is to explicitly enumerate all the
> sources classifier JARs in a profile [1]. This is of course very yucky, and
> I would love to know if there is a better way.
>
> I definitely suggest you avoid uber-JARs (with or without embedded sources)
> when possible, though; for a rationale, see http://imagej.net/Uber-JAR.
>
> Regards,
> Curtis
>
> [1] https://github.com/imagej/imagej/blob/imagej-2.0.0-rc-
> 59/pom.xml#L395-L626
>
> --
> Curtis Rueden
> LOCI software architect - https://loci.wisc.edu/software
> ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
>
>
> On Wed, Mar 8, 2017 at 4:05 PM, Ben Tatham <be...@nanometrics.ca>
> wrote:
>
> > Is there a well-known way to create an uber source jar? In other words, a
> > jar of all the source code for a project and all its dependencies (or at
> > least those that have a -sources.jar)?
> >
> > I've looked into doing it with the maven-assembly-plugin, but using a
> > dependencySet with includes of *.*.*.sources.* doesn't work because those
> > are not actually dependencies of the project.
> >
> > I perhaps could look into using dependency:sources, and specifying an
> > alternate repository to download them into (in target, eg), and then use
> a
> > fileSet of maven-assembly-plugin to add them all, but there must be a
> > better way...
> >
> > Thanks,
> > Ben
> > --
> > --
> > Ben Tatham
> > Software Architect
> >
> > *Nano**metrics* *Inc.*
> >
> > Ottawa * I*  Calgary  *I*  Houston  *I*  Beijing
> >
> > T: +1 613 505 5065  *I*  bentatham@nanometrics.ca
> >  www.nanometrics.ca  *I  *www.microseismicmonitoring.com
> >
> > This message is intended exclusively for the individual or entity to
> which
> > it is addressed. This communication may contain information that is
> > proprietary, privileged, confidential or otherwise legally exempt from
> > disclosure. If you are not the named addressee, or have been
> inadvertently
> > and erroneously referenced in the address line, you are not authorized to
> > read, print, retain, copy or disseminate this message or any part of it.
> If
> > you have received this message in error, please notify the sender
> > immediately by e-mail and delete all copies of the message.
> >
>

Re: uber source jar

Posted by Curtis Rueden <ct...@wisc.edu>.
Hi Ben,

> Is there a well-known way to create an uber source jar? In other
> words, a jar of all the source code for a project and all its
> dependencies (or at least those that have a -sources.jar)?

Good question. The way I have done it is to explicitly enumerate all the
sources classifier JARs in a profile [1]. This is of course very yucky, and
I would love to know if there is a better way.

I definitely suggest you avoid uber-JARs (with or without embedded sources)
when possible, though; for a rationale, see http://imagej.net/Uber-JAR.

Regards,
Curtis

[1] https://github.com/imagej/imagej/blob/imagej-2.0.0-rc-
59/pom.xml#L395-L626

--
Curtis Rueden
LOCI software architect - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden


On Wed, Mar 8, 2017 at 4:05 PM, Ben Tatham <be...@nanometrics.ca> wrote:

> Is there a well-known way to create an uber source jar? In other words, a
> jar of all the source code for a project and all its dependencies (or at
> least those that have a -sources.jar)?
>
> I've looked into doing it with the maven-assembly-plugin, but using a
> dependencySet with includes of *.*.*.sources.* doesn't work because those
> are not actually dependencies of the project.
>
> I perhaps could look into using dependency:sources, and specifying an
> alternate repository to download them into (in target, eg), and then use a
> fileSet of maven-assembly-plugin to add them all, but there must be a
> better way...
>
> Thanks,
> Ben
> --
> --
> Ben Tatham
> Software Architect
>
> *Nano**metrics* *Inc.*
>
> Ottawa * I*  Calgary  *I*  Houston  *I*  Beijing
>
> T: +1 613 505 5065  *I*  bentatham@nanometrics.ca
>  www.nanometrics.ca  *I  *www.microseismicmonitoring.com
>
> This message is intended exclusively for the individual or entity to which
> it is addressed. This communication may contain information that is
> proprietary, privileged, confidential or otherwise legally exempt from
> disclosure. If you are not the named addressee, or have been inadvertently
> and erroneously referenced in the address line, you are not authorized to
> read, print, retain, copy or disseminate this message or any part of it. If
> you have received this message in error, please notify the sender
> immediately by e-mail and delete all copies of the message.
>