arktekk/sbt-aether-deploy

java.lang.NoSuchMethodError: org.apache.http.conn.ssl.SSLSocketFactory on publish

bretthoerner opened this issue · 19 comments

Using sbt 0.13.5 and aether-deploy 0.13.

> +publish
[info] Setting version to 2.10.0
[info] Set current project to zookeeper-utils (in build file:/home/brett/Development/mr/scala-utils/)
[info] Wrote /home/brett/Development/mr/scala-utils/zookeeper-utils/target/scala-2.10/zookeeper-utils_2.10-2.0.2.pom
[warn] No credentials supplied for nexus.massrel.com
[trace] Stack trace suppressed: run last zookeeper-utils/*:publish for the full output.
[error] (zookeeper-utils/*:publish) java.lang.NoSuchMethodError: org.apache.http.conn.ssl.SSLSocketFactory.<init>(Ljavax/net/ssl/SSLSocketFactory;Lorg/apache/http/conn/ssl/X509HostnameVerifier;)V
[error] Total time: 0 s, completed Aug 27, 2014 10:51:07 AM

I see someone else is having this issue, also: gatling/gatling#1821 (comment)

can you please create a standalone project which shows this error?

The following hello world project fails for me:

https://github.com/bretthoerner/aether-test

$ sbt +publish
[info] Loading global plugins from /home/brett/.sbt/0.13/plugins
[info] Loading project definition from /home/brett/Development/mr/aether-test/project
[info] Set current project to aether-test (in build file:/home/brett/Development/mr/aether-test/)
[info] Setting version to 2.10.4
[info] Set current project to aether-test (in build file:/home/brett/Development/mr/aether-test/)
[info] Updating {file:/home/brett/Development/mr/aether-test/}aether-test...
[info] Wrote /home/brett/Development/mr/aether-test/target/scala-2.10/aether-test_2.10-1.0.0.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[warn] No credentials supplied for localhost
java.lang.NoSuchMethodError: org.apache.http.conn.ssl.SSLSocketFactory.<init>(Ljavax/net/ssl/SSLSocketFactory;Lorg/apache/http/conn/ssl/X509HostnameVerifier;)V
    at org.eclipse.aether.transport.http.SslSocketFactory.<init>(SslSocketFactory.java:57)
    at org.eclipse.aether.transport.http.SslSocketFactory.<init>(SslSocketFactory.java:39)
    at org.eclipse.aether.transport.http.GlobalState.newConnectionManager(GlobalState.java:166)
    at org.eclipse.aether.transport.http.LocalState.<init>(LocalState.java:54)
    at org.eclipse.aether.transport.http.HttpTransporter.<init>(HttpTransporter.java:127)
    at org.eclipse.aether.transport.http.HttpTransporterFactory.newInstance(HttpTransporterFactory.java:103)
    at org.eclipse.aether.internal.impl.DefaultTransporterProvider.newTransporter(DefaultTransporterProvider.java:127)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector.<init>(BasicRepositoryConnector.java:115)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory.newInstance(BasicRepositoryConnectorFactory.java:194)
    at org.eclipse.aether.internal.impl.DefaultRepositoryConnectorProvider.newRepositoryConnector(DefaultRepositoryConnectorProvider.java:130)
    at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:289)
    at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:269)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:434)
    at aether.Aether$.deployIt(Plugin.scala:118)
    at aether.Aether$$anonfun$deployTask$1.apply(Plugin.scala:68)
    at aether.Aether$$anonfun$deployTask$1.apply(Plugin.scala:67)
    at scala.Function7$$anonfun$tupled$1.apply(Function7.scala:35)
    at scala.Function7$$anonfun$tupled$1.apply(Function7.scala:34)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
    at sbt.std.Transform$$anon$4.work(System.scala:64)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
    at sbt.Execute.work(Execute.scala:244)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
[error] (*:publish) java.lang.NoSuchMethodError: org.apache.http.conn.ssl.SSLSocketFactory.<init>(Ljavax/net/ssl/SSLSocketFactory;Lorg/apache/http/conn/ssl/X509HostnameVerifier;)V
[error] Total time: 1 s, completed Aug 27, 2014 11:11:54 AM

Using sbt-extras and -no-share. I cannot reproduce this.

I am using Java 7. I will test again with Java 6.

./sbt -no-share publish
[info] Loading project definition from /Users/maedhros/Projects/sandbox/aether-test/project
[info] Set current project to aether-test (in build file:/Users/maedhros/Projects/sandbox/aether-test/)
[info] Wrote /Users/maedhros/Projects/sandbox/aether-test/target/scala-2.10/aether-test_2.10-1.0.0.pom
[warn] No credentials supplied for localhost
[info] Uploading: http://localhost:8081/nexus/content/repositories/releases/aether-test/aether-test_2.10/1.0.0/aether-test_2.10-1.0.0.jar
[info] Deploying aether-test:aether-test_2.10:jar:1.0.0 to releases (http://localhost:8081/nexus/content/repositories/releases, default, releases+snapshots)
[info] 2/2 KB
[info]
[info] Uploaded: http://localhost:8081/nexus/content/repositories/releases/aether-test/aether-test_2.10/1.0.0/aether-test_2.10-1.0.0.jar (2 KB at 8.1 KB/sec)
[info] Deployed aether-test:aether-test_2.10:jar:1.0.0 to releases (http://localhost:8081/nexus/content/repositories/releases, default, releases+snapshots)
[info] Uploading: http://localhost:8081/nexus/content/repositories/releases/aether-test/aether-test_2.10/1.0.0/aether-test_2.10-1.0.0.pom
[info] Deploying aether-test:aether-test_2.10:pom:1.0.0 to releases (http://localhost:8081/nexus/content/repositories/releases, default, releases+snapshots)
[info] 795/795 B
[info]
[info] Uploaded: http://localhost:8081/nexus/content/repositories/releases/aether-test/aether-test_2.10/1.0.0/aether-test_2.10-1.0.0.pom (795 B at 14.9 KB/sec)
[info] Deployed aether-test:aether-test_2.10:pom:1.0.0 to releases (http://localhost:8081/nexus/content/repositories/releases, default, releases+snapshots)
[info] Uploading: http://localhost:8081/nexus/content/repositories/releases/aether-test/aether-test_2.10/1.0.0/aether-test_2.10-1.0.0-javadoc.jar
[info] Deploying aether-test:aether-test_2.10:jar:javadoc:1.0.0 to releases (http://localhost:8081/nexus/content/repositories/releases, default, releases+snapshots)
[info] 32/336 KB
[info] 64/336 KB
[info] 96/336 KB
[info] 128/336 KB
[info] 160/336 KB
[info] 192/336 KB
[info] 224/336 KB
[info] 256/336 KB
[info] 288/336 KB
[info] 320/336 KB
[info] 336/336 KB
[info]
[info] Uploaded: http://localhost:8081/nexus/content/repositories/releases/aether-test/aether-test_2.10/1.0.0/aether-test_2.10-1.0.0-javadoc.jar (336 KB at 4243.7 KB/sec)
[info] Deployed aether-test:aether-test_2.10:jar:javadoc:1.0.0 to releases (http://localhost:8081/nexus/content/repositories/releases, default, releases+snapshots)
[info] Uploading: http://localhost:8081/nexus/content/repositories/releases/aether-test/aether-test_2.10/1.0.0/aether-test_2.10-1.0.0-sources.jar
[info] Deploying aether-test:aether-test_2.10:jar:sources:1.0.0 to releases (http://localhost:8081/nexus/content/repositories/releases, default, releases+snapshots)
[info] 546/546 B
[info]
[info] Uploaded: http://localhost:8081/nexus/content/repositories/releases/aether-test/aether-test_2.10/1.0.0/aether-test_2.10-1.0.0-sources.jar (546 B at 15.2 KB/sec)
[info] Deployed aether-test:aether-test_2.10:jar:sources:1.0.0 to releases (http://localhost:8081/nexus/content/repositories/releases, default, releases+snapshots)
[info] Resolving metadata aether-test:aether-test_2.10/maven-metadata.xml from releases (http://localhost:8081/nexus/content/repositories/releases, default, releases+snapshots)
[info] Downloading metadata aether-test:aether-test_2.10/maven-metadata.xml from releases (http://localhost:8081/nexus/content/repositories/releases, default, releases+snapshots)
[info] Downloading: http://localhost:8081/nexus/content/repositories/releases/aether-test/aether-test_2.10/maven-metadata.xml
[info]
[error] Could not find metadata aether-test:aether-test_2.10/maven-metadata.xml in releases (http://localhost:8081/nexus/content/repositories/releases)
[info] Downloaded metadata aether-test:aether-test_2.10/maven-metadata.xml from releases (http://localhost:8081/nexus/content/repositories/releases, default, releases+snapshots)
[info] Resolved metadata aether-test:aether-test_2.10/maven-metadata.xml from releases (http://localhost:8081/nexus/content/repositories/releases, default, releases+snapshots)
[info] Uploading: http://localhost:8081/nexus/content/repositories/releases/aether-test/aether-test_2.10/maven-metadata.xml
[info] Deploying aether-test:aether-test_2.10/maven-metadata.xml to releases (http://localhost:8081/nexus/content/repositories/releases, default, releases+snapshots)
[info] 307/307 B
[info]
[info] Uploaded: http://localhost:8081/nexus/content/repositories/releases/aether-test/aether-test_2.10/maven-metadata.xml (307 B at 7.1 KB/sec)
[info] Deployed aether-test:aether-test_2.10/maven-metadata.xml to releases (http://localhost:8081/nexus/content/repositories/releases, default, releases+snapshots)
[success] Total time: 1 s, completed Aug 27, 2014 6:31:56 PM

It also works with java 1.6 and 1.8.

Maybe the ivy cache is broken?

Otherwise there might be a workaround:

plugins.sbt

addSbtPlugin("no.arktekk.sbt" % "aether-deploy" % "0.13") exclude("org.eclipse.aether", "aether-transport-http")

libraryDependencies += "org.eclipse.aether" % "aether-transport-http" % "0.9.0.v20140226" exclude("org.apache.httpcomponents", "httpclient")

I'm using java 1.7.0_65, fwiw.

I don't think you can use exclude in the plugins file,

plugins.sbt:1: error: value exclude is not a member of sbt.Def.Setting[Seq[sbt.ModuleID]]
addSbtPlugin("no.arktekk.sbt" % "aether-deploy" % "0.13") exclude("org.eclipse.aether", "aether-transport-http")
                                                          ^
[error] Type error in expression
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? 

You're right, sbt-extras with -no-share works. It's interesting that both myself and someone else have an ivy cache apparently broken in the same way...

Now this I don't understand.

$ ~/bin/sbt -no-share +publish: works fine.

$ rm -rf ~/.ivy2 && ~/bin/sbt +publish: fails everytime.

My mistake, here is one updated:

addSbtPlugin("no.arktekk.sbt" % "aether-deploy" % "0.13" exclude("org.eclipse.aether", "aether-transport-http"))

libraryDependencies += "org.eclipse.aether" % "aether-transport-http" % "0.9.0.v20140226" exclude("org.apache.httpcomponents", "httpclient")

Try removing ~/.sbt/0.13 and ~/.sbt/boot

With the exclusion change my sbt project compiles, but the publish now fails with this (after I removed ~/.sbt)

java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest
    at org.eclipse.aether.transport.http.HttpTransporterFactory.newInstance(HttpTransporterFactory.java:103)
    at org.eclipse.aether.internal.impl.DefaultTransporterProvider.newTransporter(DefaultTransporterProvider.java:127)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector.<init>(BasicRepositoryConnector.java:115)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory.newInstance(BasicRepositoryConnectorFactory.java:194)
    at org.eclipse.aether.internal.impl.DefaultRepositoryConnectorProvider.newRepositoryConnector(DefaultRepositoryConnectorProvider.java:130)
    at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:289)
    at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:269)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:434)
    at aether.Aether$.deployIt(Plugin.scala:118)
    at aether.Aether$$anonfun$deployTask$1.apply(Plugin.scala:68)
    at aether.Aether$$anonfun$deployTask$1.apply(Plugin.scala:67)
    at scala.Function7$$anonfun$tupled$1.apply(Function7.scala:35)
    at scala.Function7$$anonfun$tupled$1.apply(Function7.scala:34)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
    at sbt.std.Transform$$anon$4.work(System.scala:64)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
    at sbt.Execute.work(Execute.scala:244)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.apache.http.client.methods.HttpUriRequest
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at org.eclipse.aether.transport.http.HttpTransporterFactory.newInstance(HttpTransporterFactory.java:103)
    at org.eclipse.aether.internal.impl.DefaultTransporterProvider.newTransporter(DefaultTransporterProvider.java:127)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector.<init>(BasicRepositoryConnector.java:115)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory.newInstance(BasicRepositoryConnectorFactory.java:194)
    at org.eclipse.aether.internal.impl.DefaultRepositoryConnectorProvider.newRepositoryConnector(DefaultRepositoryConnectorProvider.java:130)
    at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:289)
    at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:269)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:434)
    at aether.Aether$.deployIt(Plugin.scala:118)
    at aether.Aether$$anonfun$deployTask$1.apply(Plugin.scala:68)
    at aether.Aether$$anonfun$deployTask$1.apply(Plugin.scala:67)
    at scala.Function7$$anonfun$tupled$1.apply(Function7.scala:35)
    at scala.Function7$$anonfun$tupled$1.apply(Function7.scala:34)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
    at sbt.std.Transform$$anon$4.work(System.scala:64)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
    at sbt.Execute.work(Execute.scala:244)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
[error] (*:publish) java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest

Fascinating.

I dont think both the removal of .sbt and the exclusion is needed.

Try removing the exclusion and try again.

Got it, it seems my conflict is a global plugin,

addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3")

Thanks for your help. :)

Same as @bretthoerner : removing sbt-pgp did the trick, and aether-deploy works as expected.

the combination with sbt-pgp works if its placed in the same plugins.sbt file.

I will update the README with a caveat.

Ah, interesting, will remove it from my global plugins list and use aether-deploy at last :)

I'm encounter a [error] Could not find metadata xxxx.xml in releases (https://oss.sonatype.org/service/local/staging/deploy/maven2) when execute sbt publish,
But the command's result is success.
When I attempt close the repository in oss.sonatype.org to release it, a signature validate error occurred. I find the content not exist any .asc file and I not sure does its relate. Hope some help. Thanks

sbt publish does not do what you think it does. Take a look at sbt-pgp and publish-signed