2013-05-07 18 views
21

クイック解像度SBT:不正な企業ネクサスリポジトリ

必要な資格がネクサスで定義された正確なレルムを見込んに公開。あなたが定義したものを見つける方法は以下を参照してくださいが、最も確かに "Sonatype Nexus Repository Manager"です。通常どおり、詳細の残りの部分を資格情報に追加します。

C:/data/user/.sbt/.credentials

realm=Sonatype Nexus Repository Manager 
host=nexus 
user=repouser 
password=password 

build.sbt クレデンシャル+ =クレデンシャル(Path.userHome/".sbt"/".credentials")

publishTo <<= version { v: String => 
    val nexus = "http://nexus/" 
    if (v.trim.endsWith("SNAPSHOT")) 
    Some("snapshots" at nexus + "content/repositories/libs-snapshots") 
    else 
    Some("releases" at nexus + "content/repositories/libs-releases") 
    } 
私は、企業のネクサスレポにjarファイルを公開しようとしている

問題。

これはMavenからうまくやることができ、Nexusを使って内部のjarファイルを提供できるようにリポジトリを設定しました。ただし、承認のために発行が失敗します。

> publish 
[info] Packaging c:\app\target\scala-2.10\app_2.10-0.1-sources.jar ... 
[info] Wrote D:\app\target\scala-2.10\app_2.10-0.1.pom 
[info] :: delivering :: com.app#app_2.10;0.1 :: 0.1 :: release :: Tue May 07 18:28:44 BST  2013 
[info] Done packaging. 
[info] delivering ivy file to D:\app\target\scala-2.10\ivy-0.1.xml 
[info] Packaging D:\app\target\scala-2.10\app_2.10-0.1.jar ... 
[info] Done packaging. 
[trace] Stack trace suppressed: run last *:publish for the full output. 
[error] (*:publish) java.io.IOException: Access to URL http://nexus/content/groups/common/com/app/app_2.10/0.1/app_2.10-0.1.pom was refused by the server: Unauthorized 

C:/data/user/.sbt/.credentials

realm=X 
host=nexus 
user=repouser 
password=password 

C:/data/user/.sbt/repositories

[repositories] 
    local 
    x-repo: http://nexus/content/groups/common 
    typesafe-ivy-releases: http://repo.typesafe.com/typesafe/ivy-releases/,  [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext] 
    sbt-plugin-releases: http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/ 
    maven-central 

APP/build.sbt

name := "app" 

organization := "com.app" 

version := "0.1" 

scalaVersion := "2.10.1" 

libraryDependencies ++= Seq(
"org.scalatest" % "scalatest_2.10" % "2.0.M5b" % "test" 
) 

EclipseKeys.withSource := true 

publishMavenStyle := true 

credentials += Credentials(Path.userHome/".sbt"/".credentials") 

publishTo := Some("X Maven Repo" at "http://nexus/content/groups/common") 

My Maven settings.xml

<mirrors> 
<mirror> 
    <id>x-repo</id> 
    <name>X Maven repo</name> 
     <url>http://nexus/content/groups/common</url> 
    <mirrorOf>*</mirrorOf> 
</mirror> 
</mirrors> 

<servers> 
    <server> 
     <id>x-repo</id> 
     <username>repouser</username> 
     <password>password</password> 
    </server> 
    </servers> 

私はStackOverflowのように、このoneやメーリングリストなどthisを含むofficial docからの指示や他のさまざまな記事を、続いています。何も働かなかった。余分なロギングを有効にしようとしましたが、それ以上の詳細はありません。

私は手動でこのコマンドを使用してのmavenに展開することができます:

mvn deploy:deploy-file -Durl=http://nexus/content/repositories/libs-snapshots -DrepositoryId=x-repo -DgroupId=com.app -DartifactId=app -Dpackaging=jar -Dversion=0.1-SNAPSHOT -Dfile=D:\app\target\scala-2.10\app_2.10-0.1.jar 

は、彼らがその時に、許可する必要があるまでも運

publishTo <<= version { v: String => 
    val nexus = "http://nexus/" 
    if (v.trim.endsWith("SNAPSHOT")) 
    Some("snapshots" at nexus + "content/repositories/libs-snapshots") 
    else 
    Some("releases" at nexus + "content/repositories/libs-releases") 
    } 

ずにコマンドがOK実行、次publishToを使用してみました彼らは失敗する。

資格情報のレルムは、それがサーバーのリポジトリID、または名前に対応していますか?どちらかまたはそれは動作しません。

私はIvyのログを有効にしようとしていましたが、詳細は確認できませんでした。

set ivyLoggingLevel:= UpdateLogging。全

これによると、さらにログ記録があるはずです:

https://svn.apache.org/repos/asf/ant/ivy/core/tags/2.2.0/src/java/org/apache/ivy/util/url/IvyAuthenticator.java

私が内部プロキシの背後ので、私は、HTTPのユーザーとHTTPSのユーザーとパスワードの両方を設定する必要があります。おそらく、ブロックされているのでしょうか?

アイビーログのレベルを上げる方法を教えてください。


更新

私が展開するMavenのインフラストラクチャを使用しsbt-aether-deployプラグイン、(ワゴン)を使用することにより、動作するように何かを持っています。

資格情報はまったく同じです。実際には、領域は重要ではないようです。

次使用の行は、次のとおりです。

credentials += Credentials(Path.userHome/".sbt"/".credentials") 

publishTo <<= version { v: String => 
    val nexus = "http://nexus/" 
    if (v.trim.endsWith("SNAPSHOT")) 
    Some("snapshots" at nexus + "content/repositories/libs-snapshots") 
    else 
    Some("releases" at nexus + "content/repositories/libs-releases") 
} 

seq(aetherSettings: _*) 

seq(aetherPublishSettings: _*) 

何かが右プロキシ、ツタとネクサスの間ではありません。

私はまだアイビーを使用する提案に興味があります。


さらに更新:

curl -X POST http://nexusUser:[email protected]/content/repositories/libs-snapshots -v 

を使用するには、私は、サーバーに到達することができました。

(ローカルネットワークのために迂回するように構成されていますが、SBTのようないくつかのJavaプロセスは、ヘッダを必要とするように見える)を使用するプロキシを指定する

同じ結果

nexusUserとき

:nexusPasswordがspecificiedていなかった、私は次のヘッダーを得ていました:

WWW認証:のようなその他のカスタムリポジトリ名とは対照的に、BASICレルム=「Sonatypeネクサスリポジトリマネージャ」

効果的にそれが問題だった、資格情報が、その正確なヘッダするレルムの名前を必要とmavenが定義します。

多くの感謝!

答えて

22

Ivyは、WWW-Authenticateヘッダーの領域を使用します。このヘッダーは、資格情報ファイルで構成されたバイトと同じバイト数に一致する必要があります。

sbt-aether-deployは同じヘッダーを使用しますが、展開メカニズムとしてAetherを使用します。アイビーはしません。

WWW-Authenticateヘッダーの値を調べる最も簡単な方法は、cURLを使用することです。

curl -X POST http://nexus/content/repositories/libs-snapshots -v > /dev/null 

cURLはユーザーを求めてパスします。

-vは、要求と応答のヘッダーを見ることができるように冗長性を追加します。

+0

ありがとう、それは確かに助けた。 – fracca

+5

もう1つの非常に重要な点は、資格情報ファイルのホストがNexusサーバのIPまたはドメイン名である必要があることです。ポートを含めると、証明書が選択されません。 –

+0

私の神、これは私を狂って運転していた!本当にありがとう! – Magnus

2

資格情報ファイルのパスが正しくない可能性があります。これらの資格情報が有効であることを確認してください動作しない場合は

credentials += Credentials("Sonatype Nexus Repository Manager", 
    "nexus.scala-tools.org", "admin", "admin123") 

:それに

credentials += Credentials(Path.userHome/".sbt"/".credentials") 

credentials += Credentials("c:/data/user/.sbt/.credentials") 

または最初のトラブルシューティングに直接試みる これを変更してみてください。

+1

パスをハードコーディングするか、ファイルに直接資格情報を使用するかのいずれかを試しました。それは動作しません。 – fracca

関連する問題