Skip to content
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

IOException with different versions on subprojects #197

Closed
hugo-vrijswijk opened this issue Oct 27, 2020 · 1 comment · Fixed by #199
Closed

IOException with different versions on subprojects #197

hugo-vrijswijk opened this issue Oct 27, 2020 · 1 comment · Fixed by #199

Comments

@hugo-vrijswijk
Copy link
Contributor

hugo-vrijswijk commented Oct 27, 2020

Hi! I have the following sbt project setup:

- root (version 1.0.0)
  |
  - module a (version 1.0.0)
  - module b (version 1.1.0)

In my case, both root and module a have skip in publish := true but I am not sure if that matters.

When I try to publish using sbt "sonatypeBundleClean; +publishSigned; sonatypeBundleRelease" I see the following logs (truncated and paths slightly edited):

[info] set current project to root (in build file:/workspace/root/)
[info] Wrote /workspace/root/module-b/target/module-b-1.1.0.pom
[info]  published module-b to /workspace/root/target/sonatype-staging/1.1.0/io/stryker-mutator/module-b/1.1.0.part/module-b-1.1.0-sources.jar
[info]  published module-b to /workspace/root/target/sonatype-staging/1.1.0/io/stryker-mutator/module-b/1.1.0.part/module-b-1.1.0.pom.asc
[info]  published module-b to /workspace/root/target/sonatype-staging/1.1.0/io/stryker-mutator/module-b/1.1.0.part/module-b-1.1.0.jar
[info]  published module-b to /workspace/root/target/sonatype-staging/1.1.0/io/stryker-mutator/module-b/1.1.0.part/module-b-1.1.0-sources.jar.asc
[info]  published module-b to /workspace/root/target/sonatype-staging/1.1.0/io/stryker-mutator/module-b/1.1.0.part/module-b-1.1.0.jar.asc
[info]  published module-b to /workspace/root/target/sonatype-staging/1.1.0/io/stryker-mutator/module-b/1.1.0.part/module-b-1.1.0-javadoc.jar.asc
[info]  published module-b to /workspace/root/target/sonatype-staging/1.1.0/io/stryker-mutator/module-b/1.1.0.part/module-b-1.1.0.pom
[info]  published module-b to /workspace/root/target/sonatype-staging/1.1.0/io/stryker-mutator/module-b/1.1.0.part/module-b-1.1.0-javadoc.jar
[info]  publish commited: moved /workspace/root/target/sonatype-staging/1.1.0/io/stryker-mutator/module-b/1.1.0.part
[info]          to /workspace/root/target/sonatype-staging/1.1.0/io/stryker-mutator/module-b/1.1.0

2020-10-27 10:42:32.978+0100  info [SonatypeService] sonatypeRepository  : https://oss.sonatype.org/service/local  - (SonatypeService.scala:24)
2020-10-27 10:42:32.980+0100  info [SonatypeService] sonatypeProfileName : io.stryker-mutator  - (SonatypeService.scala:25)
[info] Preparing a new staging repository for [sbt-sonatype] root 1.0.0
2020-10-27 10:42:32.982+0100  info [SonatypeClient] Reading staging repository profiles...  - (SonatypeClient.scala:109)
2020-10-27 10:42:33.683+0100  info [SonatypeClient] Creating a staging repository in profile io.stryker-mutator with a description key: [sbt-sonatype] root 1.0.0  - (SonatypeClient.scala:127)
2020-10-27 10:42:37.953+0100  info [SonatypeService] No previous staging repository for [sbt-sonatype] root 1.0.0 was found  - (SonatypeService.scala:97)
2020-10-27 10:46:38.182+0100  info [SonatypeClient] Created successfully: iostryker-mutator-1108  - (SonatypeClient.scala:140)
2020-10-27 10:46:38.192+0100 error [Sonatype]
java.io.IOException: Supplied file /workspace/root/target/sonatype-staging/1.0.0 is a not an existing directory!
        at org.sonatype.spice.zapper.fs.AbstractDirectory.<init>(AbstractDirectory.java:32)
        at org.sonatype.spice.zapper.fs.DirectoryIOSource.<init>(DirectoryIOSource.java:68)
        at org.sonatype.spice.zapper.fs.DirectoryIOSource.<init>(DirectoryIOSource.java:59)
        at org.sonatype.spice.zapper.fs.DirectoryIOSource.<init>(DirectoryIOSource.java:50)
        at xerial.sbt.sonatype.SonatypeClient.$anonfun$uploadBundle$1(SonatypeClient.scala:286)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at scala.util.Try$.apply(Try.scala:213)
        at wvlet.airframe.control.Retry$RetryContext.runInternal(Retry.scala:265)
        at wvlet.airframe.control.Retry$RetryContext.run(Retry.scala:253)
        at xerial.sbt.sonatype.SonatypeClient.uploadBundle(SonatypeClient.scala:271)
        at xerial.sbt.sonatype.SonatypeService.uploadBundle(SonatypeService.scala:71)
        at xerial.sbt.Sonatype$.$anonfun$sonatypeBundleRelease$2(Sonatype.scala:158)
        at xerial.sbt.Sonatype$.withSonatypeService(Sonatype.scala:403)
        at xerial.sbt.Sonatype$.$anonfun$sonatypeBundleRelease$1(Sonatype.scala:154)
        at scala.Option.getOrElse(Option.scala:189)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
        at scala.Console$.withIn(Console.scala:230)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
        at scala.Console$.withOut(Console.scala:167)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
        at scala.Console$.withErr(Console.scala:196)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:111)
        at xsbt.boot.Launch$.withContextLoader(Launch.scala:131)
        at xsbt.boot.Launch$.run(Launch.scala:111)
        at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:37)
        at xsbt.boot.Launch$.launch(Launch.scala:120)
        at xsbt.boot.Launch$.apply(Launch.scala:20)
        at xsbt.boot.Boot$.runImpl(Boot.scala:56)
        at xsbt.boot.Boot$.main(Boot.scala:18)
        at xsbt.boot.Boot.main(Boot.scala)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at coursier.bootstrap.launcher.a.a(Unknown Source)  - (Sonatype.scala:409)

It looks like sbt-sonatype will always try to publish from the path of the root project version, even if subprojects have different versions (and thus different published paths)

Output of sonatypeBundleDirectory:

sbt:root> sonatypeBundleDirectory
[info] module-a / sonatypeBundleDirectory
[info]  /workspace/root/target/sonatype-staging/1.0.0
[info] module-b / sonatypeBundleDirectory
[info]  /workspace/root/target/sonatype-staging/1.1.0
[info] sonatypeBundleDirectory
[info]  /workspace/root/target/sonatype-staging/1.0.0
@xerial
Copy link
Owner

xerial commented Oct 27, 2020

The default setting is like this:

sonatypeBundleDirectory := (ThisBuild / baseDirectory).value / target.value.getName / "sonatype-staging" / s"${version.value}"

How about changing the last version.value part as a workaround?

(ThisBuild / version).value might be the right configuration, which eventually needs to be fixed at sbt-sonatype side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants