Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[featrure] Fatjar support #5

Closed
TobseF opened this issue Aug 30, 2024 · 3 comments · Fixed by #6
Closed

[featrure] Fatjar support #5

TobseF opened this issue Aug 30, 2024 · 3 comments · Fixed by #6
Labels
enhancement New feature or request

Comments

@TobseF
Copy link

TobseF commented Aug 30, 2024

The application layout with bin, conf and lib is good for developing or using it inside Docker. But I would prefer to have the option for a fat-jar with all dependencies. This makes it easier to handle to just need to download a single file. And execution is simple because I do not need to specify the classpath.

My final goal is to compile it to a native image with GraalVM, so distribution is also independent from the jvm.

I already played around with the config of the maven-assembly-plugin.
I added the jar-with-dependencies to the configuration but was not able to get it working:

<descriptorRefs>
    <descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
    <mainClass>com.github.alexisjehan.mvncheck.Application</mainClass>
</manifest>
</archive>

Of course, I can understand that this is not a must-have feature, and It may be additional work to support two assembly modes.

@AlexisJehan AlexisJehan added the enhancement New feature or request label Sep 6, 2024
@AlexisJehan
Copy link
Owner

Hello,
Even if I didn't thought about it, of course this is a great idea.

I had a look, and I identified two problems with it:

  • The Maven Resolver implementation is based on Eclipse Sisu (which is based on Google Guice) and that doesn't work well inside the JAR with dependencies.
  • The init.gradle file from the classpath couldn't be passed as an argument anymore to Gradle.

Solutions:

  • Migrate from Eclipse Sisu to the new Supplier implementation of Maven Resolver (will be compliant with the version 2 in the future)
  • Write the content of the init.gradle file to a temporary file that can be passed to Gradle

@AlexisJehan AlexisJehan linked a pull request Sep 6, 2024 that will close this issue
@AlexisJehan
Copy link
Owner

Please give it a try and feel free to report me any feedback in case you encounter some issue with it!

@AlexisJehan
Copy link
Owner

Released in 1.7.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants