How should I represent a library with two configurations in Maven Central?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

How should I represent a library with two configurations in Maven Central?

Alan Snyder
I’ve posted a question on StackOverflow that has not yet been answered.
Perhaps someone here has an answer?

https://stackoverflow.com/q/63906798/1652984?sem=2 <https://stackoverflow.com/q/63906798/1652984?sem=2>

Reply | Threaded
Open this post in threaded view
|

Re: How should I represent a library with two configurations in Maven Central?

Jörg Schaible
Hi Alan,

On Sonday, 20. September 2020, 23:50:21 CEST Alan Snyder wrote:
> I’ve posted a question on StackOverflow that has not yet been answered.
> Perhaps someone here has an answer?
>
> https://stackoverflow.com/q/63906798/1652984?sem=2
> <https://stackoverflow.com/q/63906798/1652984?sem=2>

If it is A or B exclusively, use the alternatives as part of the version string. See
- postgres (https://search.maven.org/artifact/org.postgresql/postgresql[1] )
- xstream (https://search.maven.org/artifact/com.thoughtworks.xstream/xstream[2] )

Bouncycaste uses the alternative as part of the artifactId:
- https://search.maven.org/search?q=g:org.bouncycastle[3]

However, I have often to "manage" 3rd party libraries manually that reference one of the
BC artifacts that should not be used together by using exclusions.

Using a classifier is worse, because exclusions do not work on classifiers.

Regards,
Jörg

--------
[1] https://search.maven.org/artifact/org.postgresql/postgresql
[2] https://search.maven.org/artifact/com.thoughtworks.xstream/xstream
[3] https://search.maven.org/search?q=g:org.bouncycastle
Reply | Threaded
Open this post in threaded view
|

Re: How should I represent a library with two configurations in Maven Central?

Thomas Broyer-2
+1
Use version suffixes, and think about deploying Gradle Module Metadata so
Gradle users can see them as variants of one another and more accurately
pick a version:
https://docs.gradle.org/current/userguide/publishing_gradle_module_metadata.html
and e.g. https://github.com/google/guava/pull/3683

Le lun. 21 sept. 2020 à 23:18, Jörg Schaible <[hidden email]> a
écrit :

> Hi Alan,
>
> On Sonday, 20. September 2020, 23:50:21 CEST Alan Snyder wrote:
> > I’ve posted a question on StackOverflow that has not yet been answered.
> > Perhaps someone here has an answer?
> >
> > https://stackoverflow.com/q/63906798/1652984?sem=2
> > <https://stackoverflow.com/q/63906798/1652984?sem=2>
>
> If it is A or B exclusively, use the alternatives as part of the version
> string. See
> - postgres (https://search.maven.org/artifact/org.postgresql/postgresql[1]
> )
> - xstream (
> https://search.maven.org/artifact/com.thoughtworks.xstream/xstream[2] )
>
> Bouncycaste uses the alternative as part of the artifactId:
> - https://search.maven.org/search?q=g:org.bouncycastle[3]
>
> However, I have often to "manage" 3rd party libraries manually that
> reference one of the
> BC artifacts that should not be used together by using exclusions.
>
> Using a classifier is worse, because exclusions do not work on classifiers.
>
> Regards,
> Jörg
>
> --------
> [1] https://search.maven.org/artifact/org.postgresql/postgresql
> [2] https://search.maven.org/artifact/com.thoughtworks.xstream/xstream
> [3] https://search.maven.org/search?q=g:org.bouncycastle
>
Reply | Threaded
Open this post in threaded view
|

Re: How should I represent a library with two configurations in Maven Central?

Alan Snyder
In reply to this post by Jörg Schaible
By implication, exclusions can work on versions? I have not seen any documentation that says this. Or are you talking about Gradle?



> On Sep 21, 2020, at 2:19 PM, Jörg Schaible <[hidden email]> wrote:
>
> Using a classifier is worse, because exclusions do not work on classifiers.
>

Reply | Threaded
Open this post in threaded view
|

Re: How should I represent a library with two configurations in Maven Central?

Jörg Schaible
You won't have to exclude something. A user of your library will just add a
dependencyManagement section to his/her build and select there the version (with A or B)
he/she wants. That will select the wanted version even if your lib is a transitive
dependency.


Am Dienstag, 22. September 2020, 01:01:58 CEST schrieb Alan Snyder:


By implication, exclusions can work on versions? I have not seen any documentation that
says this. Or are you talking about Gradle?






On Sep 21, 2020, at 2:19 PM, Jörg Schaible <[hidden email][1]> wrote:


Using a classifier is worse, because exclusions do not work on classifiers.






--------
[1] mailto:[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: How should I represent a library with two configurations in Maven Central?

Alan Snyder
I would still like to understand what you meant when you said that classifiers are worse then versions.

> On Sep 21, 2020, at 4:09 PM, Jörg Schaible <[hidden email]> wrote:
>
>
> You won't have to exclude something. A user of your library will just add a dependencyManagement section to his/her build and select there the version (with A or B) he/she wants. That will select the wanted version even if your lib is a transitive dependency.
>
>
> Am Dienstag, 22. September 2020, 01:01:58 CEST schrieb Alan Snyder:
>  
> By implication, exclusions can work on versions? I have not seen any documentation that says this. Or are you talking about Gradle?
>
>
>
>
> On Sep 21, 2020, at 2:19 PM, Jörg Schaible <[hidden email] <mailto:[hidden email]>> wrote:
>
> Using a classifier is worse, because exclusions do not work on classifiers.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: How should I represent a library with two configurations in Maven Central?

Jörg Schaible
On Tuesday, 22. September 2020, 01:13:11 CEST Alan Snyder wrote:
> I would still like to understand what you meant when you said that
> classifiers are worse then versions.

You cannot exclude a dependency based on its classifier.

Regards,
Jörg



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How should I represent a library with two configurations in Maven Central?

Falko Modler
> You cannot exclude a dependency based on its classifier.

Good point, never thought about that.

One downside of "flavors" / "configurations" in the version is that you
cannot filter them out properly with dependabot, e.g.:
https://github.com/quarkusio/quarkus/pull/11961


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How should I represent a library with two configurations in Maven Central?

Alan Snyder
In reply to this post by Jörg Schaible
I know that. But you also can’t exclude a dependency based on its version.

So, what comparison are you making?

> On Sep 22, 2020, at 1:28 PM, Jörg Schaible <[hidden email]> wrote:
>
> On Tuesday, 22. September 2020, 01:13:11 CEST Alan Snyder wrote:
>> I would still like to understand what you meant when you said that
>> classifiers are worse then versions.
>
> You cannot exclude a dependency based on its classifier.
>
> Regards,
> Jörg
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How should I represent a library with two configurations in Maven Central?

Jörg Schaible
On Tuesday, 22. September 2020, 23:05:12 CEST Alan Snyder wrote:
> I know that. But you also can’t exclude a dependency based on its version.
>
> So, what comparison are you making?

You don't have to exclude a dependency based on its version, this does not
make sense.

Maybe you should make yourself familiar with what a dependencyManagement
section is used for.

If you use classifiers, you have different artifacts for the same G:A:V and you
have no proper way to chose one if different ones are in your transitive deps.
With different versions you have different G:A:V and you can manage the correct
one yourself.

Regards,
Jörg




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How should I represent a library with two configurations in Maven Central?

Alan Snyder
On behalf of all ignorant people, thank you for explaining yourself.

> On Sep 22, 2020, at 3:00 PM, Jörg Schaible <[hidden email]> wrote:
>
> On Tuesday, 22. September 2020, 23:05:12 CEST Alan Snyder wrote:
>> I know that. But you also can’t exclude a dependency based on its version.
>>
>> So, what comparison are you making?
>
> You don't have to exclude a dependency based on its version, this does not
> make sense.
>
> Maybe you should make yourself familiar with what a dependencyManagement
> section is used for.
>
> If you use classifiers, you have different artifacts for the same G:A:V and you
> have no proper way to chose one if different ones are in your transitive deps.
> With different versions you have different G:A:V and you can manage the correct
> one yourself.
>
> Regards,
> Jörg
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]