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

Java plugin should not copy all jar files #893

Open
vpa1977 opened this issue Oct 31, 2024 · 5 comments
Open

Java plugin should not copy all jar files #893

vpa1977 opened this issue Oct 31, 2024 · 5 comments
Labels
Enhancement New feature or request

Comments

@vpa1977
Copy link
Contributor

vpa1977 commented Oct 31, 2024

What needs to get done

Java plugin copies all jar files found in the build output. This includes test dependencies which should not be present in the resulting image.
Java plugin is unable to distinguish between test and runtime dependencies as it is build-system specific.
We need to design a way to determine the test dependencies,.

Why it needs to get done

By default Java plugin deploys all the jar files including test dependencies.

@vpa1977 vpa1977 added the Enhancement New feature or request label Oct 31, 2024
@lengau
Copy link
Contributor

lengau commented Nov 1, 2024

I'm not sure how we'd do this computationally in a backwards-compatible manner. A workaround right now is to use stage keywords to remove those.

As you mentioned using the dist subcommand for ant/maven, we might be able to do that as an opt-in option that we can change the default for in 26.04 (or possibly even make the only way in 26.04).

@lengau
Copy link
Contributor

lengau commented Nov 1, 2024

cc @cmatsuoka @tigarmo

@tigarmo
Copy link
Contributor

tigarmo commented Nov 6, 2024

Right, this would need to be addressed per-specific plugin (maven, ant, etc). I also agree with doing an opt-in for the current plugins, and a breaking change for 26.04

@vpa1977
Copy link
Contributor Author

vpa1977 commented Nov 6, 2024

Right, this would need to be addressed per-specific plugin (maven, ant, etc). I also agree with doing an opt-in for the current plugins, and a breaking change for 26.04

The solution is more or less clear-cut for ant (we can run dist), but with maven and gradle the line is a bit murkier - the gradle tasks/maven plugins might provide several outputs which are even conflicting with each other (e.g. plain jar with dependencies vs boot jar).

The only way to resolve this is to hook into the build system itself (https://github.com/rockcrafters/java-rockcraft-plugins).

@vpa1977
Copy link
Contributor Author

vpa1977 commented Nov 27, 2024

Lets add more documentation to maven/ant and explain how to use stage keyword/dist command.

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

No branches or pull requests

3 participants