-
Notifications
You must be signed in to change notification settings - Fork 159
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
Support runtime only dependencies #980
Comments
Not disagreeing but some specific uses case you have that this would help ? (Besides slight inconvenience of a longer compile classpath ?) |
Some libraries are supposed to work without compiling against them. They just implement an API which one can use as compile dependency. By declaring those libraries as runtime dependency one can ensure that the jbang script doesn't (accidently) compile against the lib. Besides JDBC, JSR380 (Bean Validation) is another example. You need Hibernate Validator at runtime for bean validation to work, not at compile time. |
My first reaction would be that: a) either you want to specify explicitly which driver/validator to use in the script at which point I'd say there's probably no problem adding it to the compile class path as well, right? Unless there's some problem with that I'm not aware of? b) or you want to be able to specify the dependency at runtime only in which case I'd say to simply leave out the |
For editing it's useful not getting imports/content assist for stuff that shouldn't be visible. |
Well ... sure ... but that seems like pretty advanced functionality for scripts. There is a limit of gradle/maven functionality that we can cram in our simple format IMO. We're already going somewhat in that (wrong?) direction with exclusions that are using |
I totally agree that this is a convenience feature. It does not make additional things possible from a runtime perspective. Being able to exclude dependencies is something different as in it might hold be back from using jbang because of some classpath conflicts I cannot resolve. |
Closed it accidently. |
I agree with that, it seems like something necessary. I do wish there was a nicer way to define those exclusions though. The same with this, if there was a nice way to define this without resorting to a Perl-like symbol extravaganza I would be all for it :-) |
Is ! What You call a perl symbol ? :) |
It's when all features are implemented by adding yet another symbol. Having to learn (and remember) that for exclusions you have to use some kind of symbol with another kind of separator greatly increases the complexity of the script format. (Remember that you're trying to "sell" this to universities for first year students as well, not just died-in-the-wool Java experts like us :-) ) |
@quintesse i'll argue first year students that have to deal with exclusions already are on a path to a place that requires help :) by not adding lots of complex syntax to enable pass that hell faster seem good to me. |
but do please suggest an alternative to this - i'm struggling to find one that is not worse. |
wait this issue is for runtime dependencies - that is not about !. That is on #150 |
Currently every dependency which is declared using
//DEPS
is part of the compile classpath.In some cases it might be beneficial to declare dependencies as "runtime only".
A JDBC driver is one concrete example. You rarely compile against the concrete driver, but you might need it at runtime to establish the DB connection.
The text was updated successfully, but these errors were encountered: