-
Notifications
You must be signed in to change notification settings - Fork 47
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
Can't publish to Sonatype snapshot repository with 400 bad request #53
Comments
Publishing to Sonatype staging repository works:
|
A workaround I found is, appending
|
According to Sonatype blog, the version file pattern is like this: Pattern VERSION_FILE_PATTERN = Pattern.compile("^(.*)-([0-9]{8}.[0-9]{6})-([0-9]+)$" ); http://blog.sonatype.com/2008/05/maven-code-how-to-detect-if-you-have-a-snapshot-version/ |
My current solution is like this:
It would be great if sbt-dynvar can generate sonatype-friendly version string by some setting. Do you accept such an PR? |
Hey @xerial, Thanks for opening the issue. Given Sonatype's importance I think it would be good to make this use case work better out the box. The devil (as they say) is in the detail. One (possibly ideal) idea would be to define whether or not the version contains -SNAPSHOT in terms of So perhaps we could just have a setting (i.e a If we can't find a good solution there we can always resort to detailing Sonatype's expectations about version strings in the README.. |
We can also use datetime string like My idea is:
Then we can produce versions like this:
@dwijnand If this is OK, I'll create a PR for this change. |
Speaking of -SNAPSHOT things it might be good to also consider #52 when we do this change.. |
For #52,
This is more informative to tell which git revision is used. In this regard, We can use suffix |
Oh yes of course! Good idea.
I think that's something that Maven repositories already do? I remember someone explaining that, but I never looked into it. |
@dwijnand What Maven does is incrementing the suffix, -1, -2, ... to create unique SNAPSHOT versions. To do so we need to check the existing versions in the snapshot repository. But here, I think this is overkill as a feature of sbt-dynver. OK. I'll check the code how can we add dynverUseSonatypeSnapshotVersion option. |
Is there an update on this? I would love this feature. |
@leonardehrenfried I couldn't find a time for making a PR, but I guess the change would be simple. |
@xerial I've used a slight variation of your code: def versionFmt(out: sbtdynver.GitDescribeOutput): String = {
val prefix = out.ref.dropV.value
val rev = out.commitSuffix.mkString("+", "-", "")
val dirty = out.dirtySuffix.value
val ver = (rev, dirty) match {
case ("", "") =>
prefix
case (_, _) =>
// (version)+(distance)-(rev)
prefix + rev
}
val dynamicVersion = if (out.hasNoTags()) s"0.0.0-${out.version}" else ver
val isSnapshot = out.isSnapshot() || out.hasNoTags()
if (isSnapshot) s"$dynamicVersion-SNAPSHOT" else dynamicVersion
} This doesn't rely on an environment variable to figure out if something is a release or a snapshot. I'm going to test this a little more, but I think it could be the basis for the sonatype mode. |
This has probably been accidentally closed but is actually not resolved. #64 fixes it though. |
hehe |
sbt publish
to Sonatype snapshot repository with a dynver string like0.33.1+1-8ad24f59
fails with 400 error code (bad request). If I use0.33.1-SNAPSHOT
, there is no problem.@dwijnand I'm not sure the expected version path format for Sonatype repository, but if you know a workaround, let me know.
The text was updated successfully, but these errors were encountered: