-
Notifications
You must be signed in to change notification settings - Fork 87
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
Build an über jar using the standard jar plugin. #154
Conversation
jake-at-work
commented
Jul 30, 2019
- Corrects the use of class paths to get all dependencies into the jar.
- Explode all dependency jars into the über jar.
- Updates minimum Gradle in 5.5.0 (released)
- Cleanup some deprecation warnings.
Thanks for the PR. However I think it contradicts the intent of this task, which is to avoid the creation of an uber jar unless you use the shadow plugin. In particular not all projects need an uber jar, they can keep their dependencies separate. Actually I would prefer if we had an option to use either the shadow jar or your code, but keep the option to use separate jars. Does it make sense? |
Thanks for the feedback. The reason I changed this jar is because what was produced didn’t make sense to me. The jar contained the main and jmh classes and then jars from runtimeOnly (as jars embedded in this jar). I couldn’t find any real use for this jar. I assumed it was mean to produce something like the shadow jar but had been limited by older version of Gradle. So what is the intended use case for this jar? |
I agree with you that the current jar doesn't make sense. I'm not quite sure why it was implemented this way, possibly as a workaround for some JMH classloading issue. I think ideally the normal jar should remain the normal jar, nothing embedded. |
Well if there isn't value in the current implementation we should probably change it. Is there a strong need to keep an unknown thing like this around?
What do you see as a difference between a runnable JMH jar and a fat jar? What I see is that we have two things, either you are running your JMH via Gradle or not. If you run them from Gradle then you don't need the jar at all. You set the class path for the forked worker and it would execute the JHM runner, just the same as it would from the JMH app jar, but without a need to generate and include that jar. If you run it outside of Gradle then you likely want to do it the JMH way, which is the app/fat/uber jar that is documented in JMH. In this case I don't think we really need to be using shadow anymore since Gradle's jar task can do all that now too. I don't see much value in producing any other jar artifacts since it isn't common, in the JMH way of things, to exec java with a long line of jars in the class path including one that has the generated benchmark byte codes. (let Gradle do that ugliness for you) Long message short, I see really only a need for the uber/fat/app jar that contains everything necessary to execute the benchmark, call this |
No. To be honest I'm very unsatisfied by the implementation of this plugin. It should be simpler and easier to maintain. Only I don't have the bandwidth to do it.
I'm not particularly talking about a runnable jar. There should be different things:
Then we can provide something that can be executed from the CLI: java -cp bench.jar:jmh.jar Main And what I'm saying is that their could be a convenience, just like the Last, there's the fatjar version. This version can be standalone, I don't really care.
Yes and no. Gradle can do it, but shadow has way more configuration. Merging jars is not a trivial thing. There are descriptors, for example, which may need to be merged (think of Groovy extension class descriptors).
There's one value in that it keeps the structure simple and maintainable. Each step is separate. Generate classes, compile, package in a jar, generate uber jar, ... It also makes it possible to integrate with other plugins if need be. |
So given this PR improves the situation I decided to merge it. |
And 0.5.0-rc-2 is out with your changes. |