Gradle を試していて、Gradle ユーザー ガイドで説明されているように、Wagon SCP を使用して、Jar を Nexus リポジトリにアップロードしようとしています。ユーザーガイドで指定されているビルドファイルを取得しました:
configurations {
deployerJars
}
repositories {
mavenCentral()
}
dependencies {
deployerJars "org.apache.maven.wagon:wagon-ssh:1.0-beta-2"
}
uploadArchives {
repositories.mavenDeployer {
name = 'sshDeployer' // optional
configuration = configurations.deployerJars
repository(url: "scp://repos.mycompany.com/releases") {
authentication(userName: "me", password: "myPassword")
}
}
}
(もちろん、URL と資格情報が私のレポに適合していることを除いて。)
現在、gradle uploadArchivesを実行すると、しばらくするとビルドがフリーズします。ビルドをキャンセルし、情報ログをオンにして再起動したところ、スクリプトがパスワードの入力を求めていることがわかりました。
gradle -i uploadArchives
Starting Build
Settings evaluated using empty settings file.
Projects loaded. Root project using build file '/Users/developer/Slask/ex24/build.gradle'.
Included projects: [root project 'ex24']
Evaluating root project 'ex24' using build file '/Users/developer/Slask/ex24/build.gradle'.
All projects evaluated.
Selected primary task 'uploadArchives'
Tasks to be executed: [task ':compileJava', task ':processResources', task ':classes', task ':jar', task ':uploadArchives']
:compileJava
Executing task ':compileJava' due to:
No history is available for task ':compileJava'.
[ant:javac] Compiling 1 source file to /Users/developer/Slask/ex24/build/classes/main
[ant:javac] warning: [options] bootstrap class path not set in conjunction with -source 1.5
[ant:javac] 1 warning
:processResources
Skipping task ':processResources' as it has no source files.
:processResources UP-TO-DATE
:classes
Skipping task ':classes' as it has no actions.
:jar
Executing task ':jar' due to:
No history is available for task ':jar'.
:uploadArchives
Task ':uploadArchives' has not declared any outputs, assuming that it is out-of-date.
Publishing configuration: configuration ':archives'
:: loading settings :: url = jar:file:/usr/local/Cellar/gradle/1.0-milestone-7/libexec/lib/ivy-2.2.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
Publishing to Resolver org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer@53c0f47a
[ant:null] Deploying to scp://192.168.0.100/mynexusrepo
[INFO] Retrieving previous build number from remote
Password::
どうやら、ビルド スクリプトで構成されたパスワードは無視されます。
とにかく、パスワードを入力した後、何度かプロンプトが表示されたので、それに従い、パスワードを再入力しました。
最後に、ビルドは正常に完了しました。
その後、レポを確認したところ、アーティファクトが正常にアップロードされていました。
したがって、jar をレポにアップロードすると機能します。
ただし、Jenkins を使用した自動ビルド プロセスでこれを使用する予定だったので、gradle でパスワードの入力を求められてもうまくいきません。
私の質問へ: このパスワードプロンプトをオフにする方法があるかどうか誰か知っていますか?