Giter Club home page Giter Club logo

Comments (4)

Downchuck avatar Downchuck commented on June 11, 2024

In shell it looks like this, with a project that's currently using maven assembly to spit out a typical jar with dependencies:

cd project
mvn clean
mvn -DskipTests package
tar -xf target/project-SNAPSHOT-jar-with-dependencies.jar -C target/classes
rm target/classes/META-INF/MANIFEST.MF
mvn capsule:build

As an aside, the rm command is necessary because capsule maven does not skip existing manifest files, resulting in a build error when the generated manifest is added.

from capsule-maven-plugin.

chrisdchristo avatar chrisdchristo commented on June 11, 2024

Perhaps you can provide an example project containing an assembly build. And from that describe how you want the eventual capsule to look like. Just so I am sure I understand what exactly you want.

from capsule-maven-plugin.

Downchuck avatar Downchuck commented on June 11, 2024

I am distributing JARs that can be run from command line on a user machine, using Capsule to download dependencies, but run as normal on the target environment, where some dependencies are already present, and the JAR is loaded through a class loader. Think Hadoop or Tomcat, where something else is loading the JAR, but the JAR (or war) does contain a subset of dependencies.

I don't know that the feature is worth it, given that it's a one-off feature. That said, here's the other bug I encountered (needing the rm command):
https://github.com/chrischristo/capsule-maven-plugin/blob/b9ebc64089c82cfe08cbaba48ec3c72addf6b6d6/src/main/java/capsule/CapsuleMojo.java#L329
This addToJar command will throw an uncaught exception if a MANIFEST.MF file already exists in target/classes.

from capsule-maven-plugin.

chrisdchristo avatar chrisdchristo commented on June 11, 2024

Actually there was a recent addition to the plugin where you can specify <fileSets>. See here for more info. But essentially you don't need to add the jar to target manually. Just include it in a fileSet and the plugin will add it to the capsule:

<fileSets>
  <fileSet>
    <directory>target/</directory>
    <outputDirectory>/</outputDirectory>
    <includes>
      <include>project-SNAPSHOT-jar-with-dependencies.jar</include>
    </includes>
  </fileSet>
</fileSets>

So any jar, zip, war, or whatever you create with an assembly plugin, you can use the <fileSets> tag to add those to the capsule. Hopefully this is sufficient for your needs?

I also fixed the MANIFEST.MF issue (which will be for the next release).

from capsule-maven-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.