{"id":13665266,"url":"https://github.com/sbt/sbt-unique-version","last_synced_at":"2025-04-21T12:30:47.397Z","repository":{"id":3472845,"uuid":"4527776","full_name":"sbt/sbt-unique-version","owner":"sbt","description":"emulates Maven's uniqueVersion snapshots","archived":false,"fork":false,"pushed_at":"2014-05-20T21:50:08.000Z","size":190,"stargazers_count":24,"open_issues_count":2,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-08-02T06:01:50.021Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sbt.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-06-02T08:03:06.000Z","updated_at":"2019-02-28T23:06:26.000Z","dependencies_parsed_at":"2022-09-03T18:00:20.064Z","dependency_job_id":null,"html_url":"https://github.com/sbt/sbt-unique-version","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbt%2Fsbt-unique-version","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbt%2Fsbt-unique-version/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbt%2Fsbt-unique-version/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbt%2Fsbt-unique-version/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sbt","download_url":"https://codeload.github.com/sbt/sbt-unique-version/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223863905,"owners_count":17216234,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T06:00:31.267Z","updated_at":"2024-11-09T18:11:59.891Z","avatar_url":"https://github.com/sbt.png","language":"Scala","readme":"sbt-unique-version\n==================\n\nsbt-unique-version emulates Maven's `uniqueVersion` snapshots on Ivy repos.\n\nPSA\n---\n\nTry using git SHA. Josh Suereth in [Effective sbt](http://jsuereth.com/scala/2013/06/11/effective-sbt.html) at Scala Days 2013 came up with an alternative approach. This could be the approach after sbt 0.13 and up.\n\n```scala\nval gitHeadCommitSha = settingKey[String](\"current git commit SHA\")\n\ngitHeadCommitSha in ThisBuild := Process(\"git rev-parse HEAD\").lines.head\n\nversion in ThisBuild := \"1.0-\" + gitHeadCommitSha.value\n```\n\nLatest\n------\n\n```scala\nresolvers += Resolver.url(\"sbt-plugin-releases\", url(\"http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases\"))(Resolver.ivyStylePatterns)\n\nresolvers += Resolver.url(\"sbt-plugin-snapshots\", url(\"http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-snapshots\"))(Resolver.ivyStylePatterns)\n\naddSbtPlugin(\"com.eed3si9n\" % \"sbt-unique-version\" % \"latest.integration\") // or \"0.1.0\"\n```\n\nUsage\n-----\n\nAdd the following in  your `build.sbt`:\n\n```scala\nimport UniqueVersionKeys._ // put this at the top\n\nuniqueVersionSettings\n\nuniqueVersion := true\n```\n\nSet the `version` to a snapshot one such as `\"0.1.0-SNAPSHOT\"`.\nThis would substitute the artifact revision to something like `\"0.1.0-20120602-065305\"`.\n\nOptionally you can also specify the `IvyStatus` as follows:\n\n```scala\nivyStatus \u003c\u003c= (version) { (v) =\u003e\n  if (v endsWith \"-SNAPSHOT\") IvyStatus.Integration\n  else IvyStatus.Release\n}\n```\n\n### How to point at it\n\n- `\"0.1.0\"` or `\"0.1.0-20120602-073010\"` you can always use the static version number.\n- `\"0.1.0-+\"` selects the latest 0.1.0 snapshot.\n- `\"latest.integration\"` selects the latest revision regardless of its status.\n- `\"latest.milestone\"` selects the latest revision with either `Milestone` or `Release` status.\n- `\"latest.release\"` selects the latest with the `Release` status.\n\nFor example,\n\n```scala\naddSbtPlugin(\"com.eed3si9n\" % \"sbt-unique-version\" % \"0.1.0-+\")\n```\n\nThis adds the latest 0.1.0 snapshot of sbt-unique-version to your build.\n\n### What's the point of this?\n\nThe current way sbt does the snapshots is to overwrite the jar file with the same resolution URL.\nThat is a cause of several issues like caching issues and security settings at the repository.\n\n### Shortcomings\n\nUnlike Maven's `uniqueVersion`, or just plain \"x.x.x-SNAPSHOT\", this approach takes over the revision.\n","funding_links":[],"categories":["BUILD \u0026 RELEASE"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbt%2Fsbt-unique-version","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsbt%2Fsbt-unique-version","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbt%2Fsbt-unique-version/lists"}