Skip to content

Instantly share code, notes, and snippets.

@n-shinya
Created March 28, 2012 06:09
Show Gist options
  • Save n-shinya/2224147 to your computer and use it in GitHub Desktop.
Save n-shinya/2224147 to your computer and use it in GitHub Desktop.
[Play1.2.4]認証つきカスタムリポジトリに配置されたjarとPlayモジュールの依存性解決

認証つきMavenリポジトリに配置されたjarとPlayモジュールの依存性解決

こんなシチュエーション。

  • 公開したくないjarとPlayモジュールをBasic認証付きの同一サーバ(Mavenリポジトリ)においている

  • play dependencies を叩いた時にこのサーバからjarとPlayモジュールをダウンロードして依存性を解決したい

手順

~/.ivy2/ivysettings.xmlに認証情報を記述する

ファイルがなかったら作ります。

<ivysettings>
  <property name="ivy.checksums" value=""/>
  <credentials host="your.repository.com" realm="your realm" username="your name" passwd="your password" />
</ivysettings>

dependencies.ymlにカスタムリポジトリ情報を記述する

リポジトリのtypeに「chain」を使う。


require:
    - play
    - xx.yy.zzz -> common-lib 1.0 # カスタムリポジトリ上のjar
    - xx.yy.zzz -> common-module 1.0 # カスタムリポジトリ上のPlayモジュールzip

repositories:
    - your realm:
        type: chain
        using:
            - modules:
                 type:  http
                 artifact: "https://your.repository.com/xx/yy/zzz/[module]/[revision]/[module]-[revision].zip"
            - libs:
                 type:  http
                 artifact: "https://your.repository.com/xx/yy/zzz/[module]/[revision]/[module]-[revision].jar"
        contains:
            - xx.yy.zzz -> *

play depenedencies 実行

ダウンロードされるはず!

うまくダウンロードされないときは

play dependencies --debug

デバッグ情報がログとして出力される。ログに404とか401とか出力されていないか確認する。

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