Skip to content

SBT doesn't honor Maven's uniqueVersions #1322

@pdalpra

Description

@pdalpra

Steps

  • Publish an SNAPSHOT artifact to a Maven repository (with publishMavenStyle set to true, obviously)
  • Try to fetch this artifact as a dependency from Maven 3
  • Notice the trouble you're into when trying to fetch the latest SNAPSHOT...

Problems

Maven's support for "unique versions" was deprecated in Maven 2, which reached EOL in February 2014, and definitely disabled in Maven 3.
However, SBT publishes SNAPSHOT artifacts as "unique versions", which causes all kinds of trouble when trying to fetch dependencies from Maven.

Of course, I know SBT isn't Maven and does not try to be Maven, which is great, I love SBT for that, among other things.
However, I think that SBT can't ignore Maven either, as it does already with the possibility to publish POMs, to publish to Maven repos, etc...
Allowing to publish "non-unique versions" is just another step ;)

I know that the sbt-unique-version plugin allows to do that, but I honestly think this should be standard behaviour when publishing SNAPSHOT dependencies to a remote Maven repository (as long as it doesn't cause problems somewhere else, of course).

The sbt-aether-deploy plugin fixes that issue too, but pulling Maven in SBT to publish artifacts is a tiny bit overkill...
Plus, there is a version conflict on httpclient (both used by SBT and the plugin, pulled by the dependency on Aether) with SBT 0.13, causing the plugin to fail to publish artifacts (SBT isn't to blame for that, of course).

As the problem only arises when trying to fetch a dependency from a remote Maven repository (not a local repo), I suggest that :

  • Publishing to a remote repository (eg. using the publish task)
  • With publishMavenStyle to true

could trigger the change in the artifact name to include the timestamp.

Should you agree with this, I could provide a PR if you like.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions