You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Alan Snyder <fi...@cbfiddle.com> on 2020/09/20 21:50:21 UTC

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

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>


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

Posted by Alan Snyder <fi...@cbfiddle.com>.
On behalf of all ignorant people, thank you for explaining yourself.

> On Sep 22, 2020, at 3:00 PM, Jörg Schaible <jo...@gmx.de> 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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


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

Posted by Jörg Schaible <jo...@gmx.de>.
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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


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

Posted by Alan Snyder <fi...@cbfiddle.com>.
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 <jo...@gmx.de> 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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


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

Posted by Falko Modler <f....@gmx.net>.
> 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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


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

Posted by Jörg Schaible <jo...@gmx.de>.
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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


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

Posted by Alan Snyder <fi...@cbfiddle.com>.
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 <jo...@gmx.de> 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 <joerg.schaible@gmx.de <ma...@gmx.de>> wrote:
> 
> Using a classifier is worse, because exclusions do not work on classifiers.
> 
> 


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

Posted by Jörg Schaible <jo...@gmx.de>.
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 <joerg.schaible@gmx.de[1]> wrote:


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






--------
[1] mailto:joerg.schaible@gmx.de

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

Posted by Alan Snyder <fi...@cbfiddle.com>.
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 <jo...@gmx.de> wrote:
> 
> Using a classifier is worse, because exclusions do not work on classifiers.
> 


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

Posted by Thomas Broyer <t....@gmail.com>.
+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 <jo...@gmx.de> 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
>

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

Posted by Jörg Schaible <jo...@gmx.de>.
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