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

java.lang.UnsupportedOperationException with 0.12.0 and sbt 1.0.0 / 1.0.1 #38

Closed
simon-morgan opened this issue Sep 11, 2017 · 10 comments
Closed
Assignees

Comments

@simon-morgan
Copy link

Publish fails with Sbt 1.0.0 and 1.0.1 fail with release 0.12.0 but works with sbt 0.13.16. Resolving works with 0.12.0 and sbt 1.0.1

stack trace for 0.12.0 and sbt 1.0.1 ...

java.lang.UnsupportedOperationException: URL repository only support HTTP PUT at the moment
	at org.apache.ivy.util.url.BasicURLHandler.upload(BasicURLHandler.java:235)
	at org.apache.ivy.util.url.URLHandlerDispatcher.upload(URLHandlerDispatcher.java:82)
	at org.apache.ivy.util.FileUtil.copy(FileUtil.java:150)
	at org.apache.ivy.plugins.repository.url.URLRepository.put(URLRepository.java:84)
	at sbt.internal.librarymanagement.ConvertResolver$LocalIfFileRepo.put(ConvertResolver.scala:369)
	at org.apache.ivy.plugins.repository.AbstractRepository.put(AbstractRepository.java:130)
	at sbt.internal.librarymanagement.ConvertResolver$ChecksumFriendlyURLResolver.put(ConvertResolver.scala:121)
	at sbt.internal.librarymanagement.ConvertResolver$ChecksumFriendlyURLResolver.put$(ConvertResolver.scala:108)
	at sbt.internal.librarymanagement.ConvertResolver$$anonfun$defaultConvert$lzycompute$1$PluginCapableResolver$1.put(ConvertResolver.scala:168)
	at org.apache.ivy.plugins.resolver.RepositoryResolver.publish(RepositoryResolver.java:216)
	at sbt.internal.librarymanagement.IvyActions$.$anonfun$publish$5(IvyActions.scala:492)
	at sbt.internal.librarymanagement.IvyActions$.$anonfun$publish$5$adapted(IvyActions.scala:491)
	at scala.collection.TraversableLike$WithFilter.$anonfun$foreach$1(TraversableLike.scala:789)
	at scala.collection.Iterator.foreach(Iterator.scala:929)
	at scala.collection.Iterator.foreach$(Iterator.scala:929)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1417)
	at scala.collection.IterableLike.foreach(IterableLike.scala:71)
	at scala.collection.IterableLike.foreach$(IterableLike.scala:70)
	at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
	at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:788)
	at sbt.internal.librarymanagement.IvyActions$.publish(IvyActions.scala:491)
	at sbt.internal.librarymanagement.IvyActions$.$anonfun$publish$3(IvyActions.scala:141)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at sbt.internal.librarymanagement.IvyActions$.withChecksums(IvyActions.scala:154)
	at sbt.internal.librarymanagement.IvyActions$.withChecksums(IvyActions.scala:148)
	at sbt.internal.librarymanagement.IvyActions$.$anonfun$publish$1(IvyActions.scala:141)
	at sbt.internal.librarymanagement.IvyActions$.$anonfun$publish$1$adapted(IvyActions.scala:131)
	at sbt.internal.librarymanagement.IvySbt$Module.$anonfun$withModule$1(Ivy.scala:229)
	at sbt.internal.librarymanagement.IvySbt.$anonfun$withIvy$1(Ivy.scala:190)
	at sbt.internal.librarymanagement.IvySbt.sbt$internal$librarymanagement$IvySbt$$action$1(Ivy.scala:70)
	at sbt.internal.librarymanagement.IvySbt$$anon$3.call(Ivy.scala:77)
	at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:93)
	at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:78)
	at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:97)
	at xsbt.boot.Using$.withResource(Using.scala:10)
	at xsbt.boot.Using$.apply(Using.scala:9)
	at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:58)
	at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:48)
	at xsbt.boot.Locks$.apply0(Locks.scala:31)
	at xsbt.boot.Locks$.apply(Locks.scala:28)
	at sbt.internal.librarymanagement.IvySbt.withDefaultLogger(Ivy.scala:77)
	at sbt.internal.librarymanagement.IvySbt.withIvy(Ivy.scala:185)
	at sbt.internal.librarymanagement.IvySbt.withIvy(Ivy.scala:182)
	at sbt.internal.librarymanagement.IvySbt$Module.withModule(Ivy.scala:228)
	at sbt.internal.librarymanagement.IvyActions$.publish(IvyActions.scala:131)
	at sbt.Classpaths$.$anonfun$publishTask$4(Defaults.scala:2170)
	at sbt.Classpaths$.$anonfun$publishTask$4$adapted(Defaults.scala:2168)
	at scala.Function1.$anonfun$compose$1(Function1.scala:44)
	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:42)
	at sbt.std.Transform$$anon$4.work(System.scala:64)
	at sbt.Execute.$anonfun$submit$2(Execute.scala:257)
	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
	at sbt.Execute.work(Execute.scala:266)
	at sbt.Execute.$anonfun$submit$1(Execute.scala:257)
	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:167)
	at sbt.CompletionService$$anon$2.call(CompletionService.scala:32)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)
(*:publish) java.lang.UnsupportedOperationException: URL repository only support HTTP PUT at the moment
@julianhowarth
Copy link

I'm seeing this behaviour as well - blocker for upgrading my projects to sbt 1.0.x at the moment

@joan38
Copy link

joan38 commented Oct 5, 2017

Seeing the same issue, not sure what to do...

@tpunder
Copy link
Owner

tpunder commented Oct 18, 2017

I played around with SBT 1.0 a little bit when it came out and ran into some issues (not sure if they were SBT 1.0 issues or issues with this plugin) and just haven't circled back yet. I'll see if I can find time to try upgrading all my projects to SBT 1.0 again and make this this plugin works right.

@tpunder tpunder self-assigned this Oct 20, 2017
@tpunder
Copy link
Owner

tpunder commented Oct 20, 2017

I'm attempting to upgrade some projects to SBT 1.0.2 and am able to repro the issue

@tpunder
Copy link
Owner

tpunder commented Oct 20, 2017

The Exception comes from here: https://github.com/apache/ant-ivy/blob/master/src/java/org/apache/ivy/util/url/BasicURLHandler.java#L273

@Override
public void upload(final File src, final URL dest, final CopyProgressListener listener,
                   final TimeoutConstraint timeoutConstraint) throws IOException {

  if (!"http".equals(dest.getProtocol()) && !"https".equals(dest.getProtocol())) {
      throw new UnsupportedOperationException(
              "URL repository only support HTTP PUT at the moment");
  }
  

That seems to mean it's not going through the S3URLHandler: https://github.com/frugalmechanic/fm-sbt-s3-resolver/blob/master/src/main/scala/fm/sbt/S3URLHandler.scala

@tpunder
Copy link
Owner

tpunder commented Oct 20, 2017

@joan38
Copy link

joan38 commented Nov 22, 2017

Only the publishing part is impacted.
My super dirty workaround:

publish := {
  def upload(file: File, repo: String) = {
    val artifactName = file.getName.split("-").head
    val dest = s"$repo/${organization.value.replace(".", "/")}/$artifactName/${version.value}/${file.getName}"
    s"aws s3 cp ${file.getAbsolutePath} $dest".!
  }

  val repo = "s3://my-repositories/path"
  upload((packageBin in Compile).value, repo)
  upload(makePom.value, repo)
}

Works also with cross compiled projects like ScalaJS

@tpunder
Copy link
Owner

tpunder commented Nov 22, 2017

I have pull request for https://github.com/sbt/librarymanagement that fixes this: sbt/librarymanagement#183

@tpunder
Copy link
Owner

tpunder commented Nov 28, 2017

I see sbt 1.0.4 got released with my sbt/librarymanagement fix. Anybody test it out yet?

https://github.com/sbt/sbt/releases/tag/v1.0.4

@joan38
Copy link

joan38 commented Nov 29, 2017

Yes it works! Thanks so much!

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

No branches or pull requests

4 participants