Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Creating a shaded/"uber-jar?"

Hello,

I also need to build an uber-jar for a standalone version of a tool using EMF plugins. For the moment, I use the eclipse:to-maven goal from the Apache Maven Eclipse Plugin which is "retired" but still available. The maven-shade-plugin is then able to find the needed dependencies, but the top one must be listed in the pom file.

I plan to try the maven-dependency-plugin, and also the spring-boot-maven-plugin, to compare with my solution. But I will be happy to heard about other tries.

Regards,
Dominique
 
Le 10/07/2019 à 19:40, Greg Watson a écrit :
Hi Mattias,

We’ve been trying to work this out too. How are you planning to use the plugins? Are you going to have an OSGi framework in your app? There doesn’t seem to be an easy way to load OSGi plugins from an uber jar using Felix, but maybe the other frameworks have something...

The only way I’ve found to create the jar is using the maven-dependency plugin then the maven-assembly plugin to package them up as a jar.

Regards,
Greg

On Jul 10, 2019, at 11:16 AM, Matthias Schoettle <eclipse@xxxxxxxxxxx> wrote:

Hello,

We are trying to create an "uber-jar" as well (for a standalone application that uses EMF, i.e., there are a lot of dependencies to Eclipse plugins that are not in any Maven repository) and based on my understanding Tycho uses a system scope [1] for dependencies that it resolves through p2. The maven-shade plugin can't find those. The maven-dependency plugin, however, is able to resolve the dependencies found by Tycho, so it is possible to use the copy-dependencies goal for example. But it's not ideal.

What is the best way to handle a case like this?
Is the spring-boot-maven-plugin able to resolve those plugins?

Thanks,
Matthias

[1] https://stackoverflow.com/a/42420648

On 07.06.2019 21:47, Jay Jay Billings wrote:
Matthias,
Excellent! Thanks! I think this will help with some of our next steps.
Jay
On Fri, Jun 7, 2019 at 9:25 PM Matthias Sohn <matthias.sohn@xxxxxxxxx>
wrote:
We used the maven-shade-plugin to build the jgit command line app:

https://git.eclipse.org/r/plugins/gitiles/jgit/jgit/+/refs/changes/43/135143/2/org.eclipse.jgit.pgm/pom.xml#175

We switched to the spring-boot-maven-plugin and now use nested jars
since we added Bouncycastle for signing support which is JCE and Eclipse
signed.
These signatures would break during shading and we didn't want to re-sign
the shaded jar
since the JCE signature is meant to be used for JCE providers only.

See change https://git.eclipse.org/r/#/c/133417
<https://git.eclipse.org/r/#/c/133417/31/org.eclipse.jgit.pgm/pom.xml>
especially
https://git.eclipse.org/r/#/c/133417/31/org.eclipse.jgit.pgm/pom.xml

here are the complete sources of the  pom.xml

https://git.eclipse.org/r/plugins/gitiles/jgit/jgit/+/master/org.eclipse.jgit.pgm/pom.xml
and the shell script we use to start the command line application

https://git.eclipse.org/r/plugins/gitiles/jgit/jgit/+/master/org.eclipse.jgit.pgm/jgit.sh

-Matthias

On Fri, Jun 7, 2019 at 11:03 PM Jay Jay Billings <jayjaybillings@xxxxxxxxx>
wrote:

FYI - Greg and I looked at this more. Something like this appears to work:

            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-p2-repository-plugin</artifactId>
                <version>${tycho-version}</version>
                <configuration>
            <!--
 <createArtifactRepository>false</createArtifactRepository>-->
                    <includeAllDependencies>true</includeAllDependencies>
                </configuration>
            </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.4.3</version>
        <configuration>
          <!-- put your configurations here -->
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

This produces a single shaded jar that appears to be correct, but I
haven't tried it in a program yet.

Jay

On Fri, Jun 7, 2019 at 3:43 PM Jay Jay Billings <jayjaybillings@xxxxxxxxx>
wrote:

Hello Tycho team!

Does anyone have a suggestion for how to create a shaded/uber-jar of a
project and all of its dependencies? This would be comparable to using the
maven-shaded plugin. I have found one good reference for it on the mailing
list:

https://www.eclipse.org/lists/tycho-user/msg05978.html

Is that still the best way to do it?

Here's our use case. Greg Watson and I are looking taking some of the
backend bundles from Eclipse PTP and Eclipse ICE to use in some new web
services we are building. These are Spring+Vaadin web applications, so it
would be easiest for us to just put a gigantic jar on the classpath.

Any thoughts or suggestions?

Best,
Jay

--
Jay Jay Billings
Twitter Handle: @jayjaybillings



--
Jay Jay Billings
Twitter Handle: @jayjaybillings
_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://www.eclipse.org/mailman/listinfo/tycho-user

_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://www.eclipse.org/mailman/listinfo/tycho-user
_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/tycho-user
_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/tycho-user


_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/tycho-user

Back to the top