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

[bug] external classes embedded in jcasbin's distribution jar #425

Closed
tpsb opened this issue Oct 2, 2024 · 4 comments
Closed

[bug] external classes embedded in jcasbin's distribution jar #425

tpsb opened this issue Oct 2, 2024 · 4 comments
Assignees
Labels

Comments

@tpsb
Copy link

tpsb commented Oct 2, 2024

With the introduction of CLI (v1.57.0) the project now uses shade plugin and includes some of the dependencies in the built jar.
When using jcasbin as a library in a project where no CLI is needed this introduces certain issues:

  • the project might want to use a different version of a library than the one included in the jar and depending where the jars end up on the classpath, invalid classes might get used,
  • having some of the libraries included directly in casbin's jar obscures proper dependency management and analysis.

In my specific case the problem surfaced as I use a newer version of slf4j-api and use some of the newly introduced APIs that the version of slf4j included in the jcasbin's jar does not have, and it happens that jcasbin's jar comes before the proper slf4j-api jar on the classpath and incorrect versions of classes are resolved resulting in failed compilations.

central.sonatype.com shows that between version 1.55.0 and 1.63.0 the number of dependencies fell by 10 so I'd assume that classes from 10 external jars get now embedded in jcasbin's jar.

I don't think the library jar should include any non-project specific classes. Please consider creating a separate CLI specific distribution that would embed the necessary dependencies and keep the library jar clean of external dependencies being embedded in.

@casbin-bot
Copy link
Member

@tangyang9464 @imp2002

@tpsb tpsb changed the title external classes embedded in jcasbin's distribution jar [bug] external classes embedded in jcasbin's distribution jar Oct 2, 2024
@hsluoyz
Copy link
Member

hsluoyz commented Oct 2, 2024

@tpsb can you check which release (aka pull request) causes the issue you mentioned? https://github.com/casbin/jcasbin/releases

Even if we have no Maven registry release for some recent versions, you can still git clone that revision and build the jar by yourself to check

@tpsb
Copy link
Author

tpsb commented Oct 2, 2024

it's tag v1.57.0 which corresponds to PR#402

@hsluoyz
Copy link
Member

hsluoyz commented Oct 2, 2024

@tpsb PR: #402 has been reverted: d2e2f78

@hsluoyz hsluoyz closed this as completed Oct 2, 2024
@hsluoyz hsluoyz added bug and removed question labels Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants