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

Option to omit version for optional dependencies #43

Open
Vampire opened this issue Feb 8, 2019 · 2 comments
Open

Option to omit version for optional dependencies #43

Vampire opened this issue Feb 8, 2019 · 2 comments

Comments

@Vampire
Copy link

Vampire commented Feb 8, 2019

It would be nice if you could also leave out the version for optional dependencies in the resulting POM.
Leaving it out in the Gradle script might not work, as you then can get problems resolving your configurations.
But as the version of optional dependencies is not taken into account anyway, neither be Gradle nor by Maven, it would be nice if it could also be left out in the resulting pom.

@chali
Copy link
Member

chali commented Feb 11, 2019

Hi @Vampire I'm not sure I understand the point of optional dependencies is that they have a version in POM file. For example, you consume artifact A which has an optional transitive dependency B in version 1.0 That means if you add B as you direct dependency you don't have to specify version because the optional path will be considered and version will be supplied from there. Publishing it as optional without version would be against this use case. Am I misunderstanding something?

@Vampire
Copy link
Author

Vampire commented Dec 2, 2021

According to https://blog.gradle.org/optional-dependencies the optional dependencies are purely informational in both Maven and Gradle.
Gradle once had some feature preview where the optional dependencies versions were considered as version constraints, so that you indeed could declare the dependency without version and get the one from the POM.
But afair this caused too much hassle and was different from Maven which just ignores it, so before making that feature preview stable, they removed the optional handling again and just ignore them as Maven does.

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

No branches or pull requests

2 participants