arktekk / sbt-aether-deploy

Deploy SBT artifacts using Maven Artifact Resolver (formerly Eclipse Aether)
Other
84 stars 31 forks source link

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

Closed bretthoerner closed 10 years ago

bretthoerner commented 10 years ago

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
bretthoerner commented 10 years ago

I see someone else is having this issue, also: https://github.com/gatling/gatling/issues/1821#issuecomment-52030386

hamnis commented 10 years ago

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

bretthoerner commented 10 years ago

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
hamnis commented 10 years ago

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

hamnis commented 10 years ago

It also works with java 1.6 and 1.8.

hamnis commented 10 years ago

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")
bretthoerner commented 10 years ago

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? 
bretthoerner commented 10 years ago

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...

bretthoerner commented 10 years ago

Now this I don't understand.

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

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

hamnis commented 10 years ago

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

bretthoerner commented 10 years ago

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
hamnis commented 10 years ago

Fascinating.

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

Try removing the exclusion and try again.

bretthoerner commented 10 years ago

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

addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3")
bretthoerner commented 10 years ago

Thanks for your help. :)

pdalpra commented 10 years ago

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

hamnis commented 10 years ago

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

I will update the README with a caveat.

pdalpra commented 10 years ago

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

LoranceChen commented 8 years ago

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

hamnis commented 8 years ago

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