Ошибка 405 PUT | Как опубликовать на нексусе через sbt? - PullRequest
0 голосов
/ 01 ноября 2018

Я тестирую локально развернутый Nexus, используя демонстрационный проект. Я создал этот репо: com.example на Nexus, используя Create Repository. URL-адрес хранилища на локальном Nexus: http://localhost:8081/repository/com.example/.

Конфигурация в build.sbt выглядит так:

name := "data-models"

version := "0.1"

scalaVersion := "2.12.7"

organization := "com.example"

val snapshotsName = "Repository Snapshots"
val snapshotsUrl = new java.net.URL("http://localhost:8081/repository/com.example/")
val snapshotsPattern = "[organisation]/[module]/[revision]-SNAPSHOT/[artifact]-[revision](-[timestamp]).[ext]"
val snapshots = Resolver.url(snapshotsName, snapshotsUrl)(Patterns(snapshotsPattern))
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")

publishTo := Some("Sonatype Nexus Repository Manager" at "http://localhost:8081/repository/com.example/")

Конфиденциальность Conf выглядит так:

realm=Sonatype Nexus Repository Manager
host=localhost:8081
user=admin
password=qwerty123#345ty

Затем я пытаюсь запустить sbt publish.

Я получаю эту ошибку:

[info] Loading project definition from /home/yash/IdeaProjects/data-models/project
[info] Loading settings for project data-models from build.sbt ...
[info] Set current project to data-models (in build file:/home/yash/IdeaProjects/data-models/)
[info] Packaging /home/yash/IdeaProjects/data-models/target/scala-2.12/data-models_2.12-0.1-sources.jar ...
[info] Updating ...
[info] Done packaging.
[info] Done updating.
[info] Wrote /home/yash/IdeaProjects/data-models/target/scala-2.12/data-models_2.12-0.1.pom
[info] Packaging /home/yash/IdeaProjects/data-models/target/scala-2.12/data-models_2.12-0.1.jar ...
[info] Done packaging.
[error] java.io.IOException: PUT operation to URL http://localhost:8081/com/example/data-models_2.12/0.1/data-models_2.12-0.1.pom failed with status code 405: HTTP method PUT is not supported by this URL
[error]         at org.apache.ivy.util.url.AbstractURLHandler.validatePutStatusCode(AbstractURLHandler.java:82)
[error]         at sbt.internal.librarymanagement.ivyint.GigahorseUrlHandler.upload(GigahorseUrlHandler.scala:191)
[error]         at org.apache.ivy.util.url.URLHandlerDispatcher.upload(URLHandlerDispatcher.java:82)
[error]         at org.apache.ivy.util.FileUtil.copy(FileUtil.java:150)
[error]         at org.apache.ivy.plugins.repository.url.URLRepository.put(URLRepository.java:84)
[error]         at sbt.internal.librarymanagement.ConvertResolver$LocalIfFileRepo.put(ConvertResolver.scala:366)
[error]         at org.apache.ivy.plugins.repository.AbstractRepository.put(AbstractRepository.java:130)
[error]         at sbt.internal.librarymanagement.ConvertResolver$ChecksumFriendlyURLResolver.put(ConvertResolver.scala:118)
[error]         at sbt.internal.librarymanagement.ConvertResolver$ChecksumFriendlyURLResolver.put$(ConvertResolver.scala:105)
[error]         at sbt.internal.librarymanagement.ConvertResolver$$anonfun$defaultConvert$lzycompute$1$PluginCapableResolver$1.put(ConvertResolver.scala:165)
[error]         at org.apache.ivy.plugins.resolver.RepositoryResolver.publish(RepositoryResolver.java:216)
[error]         at sbt.internal.librarymanagement.IvyActions$.$anonfun$publish$5(IvyActions.scala:497)
[error]         at sbt.internal.librarymanagement.IvyActions$.$anonfun$publish$5$adapted(IvyActions.scala:496)
[error]         at scala.collection.TraversableLike$WithFilter.$anonfun$foreach$1(TraversableLike.scala:788)
[error]         at scala.collection.Iterator.foreach(Iterator.scala:937)
[error]         at scala.collection.Iterator.foreach$(Iterator.scala:937)
[error]         at scala.collection.AbstractIterator.foreach(Iterator.scala:1425)
[error]         at scala.collection.IterableLike.foreach(IterableLike.scala:70)
[error]         at scala.collection.IterableLike.foreach$(IterableLike.scala:69)
[error]         at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
[error]         at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:787)
[error]         at sbt.internal.librarymanagement.IvyActions$.publish(IvyActions.scala:496)
[error]         at sbt.internal.librarymanagement.IvyActions$.$anonfun$publish$3(IvyActions.scala:144)
[error]         at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error]         at sbt.internal.librarymanagement.IvyActions$.withChecksums(IvyActions.scala:157)
[error]         at sbt.internal.librarymanagement.IvyActions$.withChecksums(IvyActions.scala:151)
[error]         at sbt.internal.librarymanagement.IvyActions$.$anonfun$publish$1(IvyActions.scala:144)
[error]         at sbt.internal.librarymanagement.IvyActions$.$anonfun$publish$1$adapted(IvyActions.scala:134)
[error]         at sbt.internal.librarymanagement.IvySbt$Module.$anonfun$withModule$1(Ivy.scala:239)
[error]         at sbt.internal.librarymanagement.IvySbt.$anonfun$withIvy$1(Ivy.scala:204)
[error]         at sbt.internal.librarymanagement.IvySbt.sbt$internal$librarymanagement$IvySbt$$action$1(Ivy.scala:70)
[error]         at sbt.internal.librarymanagement.IvySbt$$anon$3.call(Ivy.scala:77)
[error]         at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:95)
[error]         at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:80)
[error]         at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:99)
[error]         at xsbt.boot.Using$.withResource(Using.scala:10)
[error]         at xsbt.boot.Using$.apply(Using.scala:9)
[error]         at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:60)
[error]         at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:50)
[error]         at xsbt.boot.Locks$.apply0(Locks.scala:31)
[error]         at xsbt.boot.Locks$.apply(Locks.scala:28)
[error]         at sbt.internal.librarymanagement.IvySbt.withDefaultLogger(Ivy.scala:77)
[error]         at sbt.internal.librarymanagement.IvySbt.withIvy(Ivy.scala:199)
[error]         at sbt.internal.librarymanagement.IvySbt.withIvy(Ivy.scala:196)
[error]         at sbt.internal.librarymanagement.IvySbt$Module.withModule(Ivy.scala:238)
[error]         at sbt.internal.librarymanagement.IvyActions$.publish(IvyActions.scala:134)
[error]         at sbt.Classpaths$.$anonfun$publishTask$4(Defaults.scala:2411)
[error]         at sbt.Classpaths$.$anonfun$publishTask$4$adapted(Defaults.scala:2411)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
[error]         at sbt.std.Transform$$anon$4.work(System.scala:67)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error]         at sbt.Execute.work(Execute.scala:278)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error]         at java.lang.Thread.run(Thread.java:748)
[error] (publish) java.io.IOException: PUT operation to URL http://localhost:8081/com/example/data-models_2.12/0.1/data-models_2.12-0.1.pom failed with status code 405: HTTP method PUT is not supported by this URL

Я не могу понять, что не так. Это правильный способ сделать это? Какой правильный путь?

Заранее спасибо.

Прикрепление скриншота репозитория Nexus.

enter image description here

1 Ответ

0 голосов
/ 02 ноября 2018

Я думаю, что нашел проблему, на самом деле, мне кажется, что требуется репо типа SNAPSHOT и ключевое слово -snapshot в бинарном пакете, который мы хотим развернуть.

Как только я настроил это как:

name := "data-models"

version := "1.0.0-SNAPSHOT"

scalaVersion := "2.11.7"

organization := "com.example"

val snapshotsName = "Repository Snapshots"
val snapshotsUrl = new java.net.URL("http://localhost:8081/repository/example-snapshot/")
val snapshotsPattern = "[organisation]/[module]/[revision]-SNAPSHOT/[artifact]-[revision](-[timestamp]).[ext]"
val snapshots = Resolver.url(snapshotsName, snapshotsUrl)(Patterns(snapshotsPattern))
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
//credentials += Credentials("Sonatype Nexus Repository Manager", "localhost", "admin", "qwerty123#")

publishTo := Some("Sonatype Nexus Repository Manager" at "http://localhost:8081/repository/example-snapshot/")

Началось развертывание.

...