kaakaa Blog

この世は極楽 空にはとんぼ

TracLightningのMavenリポジトリにアップロードできない

Gradle Maven Pluginを使ってTracLightningMavenリポジトリにJarをアップロードしようとしてみたところ、アップロード先のディレクトリを用意しておかないとエラーとなった。

build.gradle

apply plugin: 'java'
apply plugin: 'maven'

group = 'org.kaakaa.sample'
archivesBaseName = 'homeSample'
version = '1.0'

repositories {
    mavenCentral()
}

uploadArchives {
    repositories.mavenDeployer {
        repository(url: 'http://192.168.3.10/maven/') {
            authentication(userName: 'admin', password: 'admin')
        }
    }
}

dependencies {
    compile 'org.slf4j:slf4j-api:1.7.5'

    testCompile 'junit:junit:4.11'
}

アップロード先ディレクトリを作っておかないと。

[vagrant@localhost]/vagrant/dev/gradle/mvn_sample% gradle uploadArchives --info
Starting Build
Settings evaluated using settings file '/vagrant/dev/gradle/mvn_sample/settings.gradle'.
Projects loaded. Root project using build file '/vagrant/dev/gradle/mvn_sample/build.gradle'.
Included projects: [root project 'mvn_sample']
Evaluating root project 'mvn_sample' using build file '/vagrant/dev/gradle/mvn_sample/build.gradle'.
All projects evaluated.
Selected primary task 'uploadArchives'
Tasks to be executed: [task ':compileJava', task ':processResources', task ':classes', task ':jar', task ':uploadArchives']
:compileJava (Thread[main,5,main]) started.
:compileJava
Skipping task ':compileJava' as it is up-to-date (took 1.57 secs).
:compileJava UP-TO-DATE
:compileJava (Thread[main,5,main]) completed. Took 1.704 secs.
:processResources (Thread[main,5,main]) started.
:processResources
Skipping task ':processResources' as it has no source files.
:processResources UP-TO-DATE
:processResources (Thread[main,5,main]) completed. Took 0.014 secs.
:classes (Thread[main,5,main]) started.
:classes
Skipping task ':classes' as it has no actions.
:classes UP-TO-DATE
:classes (Thread[main,5,main]) completed. Took 0.007 secs.
:jar (Thread[main,5,main]) started.
:jar
Skipping task ':jar' as it is up-to-date (took 0.206 secs).
:jar UP-TO-DATE
:jar (Thread[main,5,main]) completed. Took 0.25 secs.
:uploadArchives (Thread[main,5,main]) started.
:uploadArchives
Executing task ':uploadArchives' (up-to-date check took 0.004 secs) due to:
  Task has not declared any outputs.
Publishing configuration: configuration ':archives'
Publishing to org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer@52068591
[ant:null] Deploying to http://192.168.3.10/maven/
Uploading: org/kaakaa/sample/homeSample/1.0/homeSample-1.0.jar to repository remote at http://192.168.3.10/maven/
Transferring 1K from remote
[ant:null] An error has occurred while processing the Maven artifact tasks.
 Diagnosis:

Error deploying artifact 'org.kaakaa.sample:homeSample:jar': Error deploying artifact: Authorization failed: Access denied to: http://192.168.3.10/maven/org/kaakaa/sample/homeSample/1.0/homeSample-1.0.jar

:uploadArchives FAILED
:uploadArchives (Thread[main,5,main]) completed. Took 3.328 secs.

FAILURE: Build failed with an exception.

  What went wrong:
Execution failed for task ':uploadArchives'.
> Could not publish configuration 'archives'
   > Error deploying artifact 'org.kaakaa.sample:homeSample:jar': Error deploying artifact: Authorization failed: Access denied to: http://192.168.3.10/maven/org/kaakaa/sample/homeSample/1.0/homeSample-1.0.jar

  Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED

Total time: 14.628 secs
Stopped 0 compiler daemon(s).

アップロード先のディレクトリ(%TRAC_HOME%/maven/org/kaakaa/sample/homeSample/1.0/)を作っておくと。

[vagrant@localhost]/vagrant/dev/gradle/mvn_sample% gradle uploadArchives --info
Starting Build
Settings evaluated using settings file '/vagrant/dev/gradle/mvn_sample/settings.gradle'.
Projects loaded. Root project using build file '/vagrant/dev/gradle/mvn_sample/build.gradle'.
Included projects: [root project 'mvn_sample']
Evaluating root project 'mvn_sample' using build file '/vagrant/dev/gradle/mvn_sample/build.gradle'.
All projects evaluated.
Selected primary task 'uploadArchives'
Tasks to be executed: [task ':compileJava', task ':processResources', task ':classes', task ':jar', task ':uploadArchives']
:compileJava (Thread[main,5,main]) started.
:compileJava
Skipping task ':compileJava' as it is up-to-date (took 1.503 secs).
:compileJava UP-TO-DATE
:compileJava (Thread[main,5,main]) completed. Took 1.643 secs.
:processResources (Thread[main,5,main]) started.
:processResources
Skipping task ':processResources' as it has no source files.
:processResources UP-TO-DATE
:processResources (Thread[main,5,main]) completed. Took 0.01 secs.
:classes (Thread[main,5,main]) started.
:classes
Skipping task ':classes' as it has no actions.
:classes UP-TO-DATE
:classes (Thread[main,5,main]) completed. Took 0.006 secs.
:jar (Thread[main,5,main]) started.
:jar
Skipping task ':jar' as it is up-to-date (took 0.201 secs).
:jar UP-TO-DATE
:jar (Thread[main,5,main]) completed. Took 0.244 secs.
:uploadArchives (Thread[main,5,main]) started.
:uploadArchives
Executing task ':uploadArchives' (up-to-date check took 0.004 secs) due to:
  Task has not declared any outputs.
Publishing configuration: configuration ':archives'
Publishing to org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer@6ebcf6bf
[ant:null] Deploying to http://192.168.3.10/maven/
Uploading: org/kaakaa/sample/homeSample/1.0/homeSample-1.0.jar to repository remote at http://192.168.3.10/maven/
Transferring 1K from remote
Uploaded 1K
[INFO] Retrieving previous metadata from remote
[INFO] repository metadata for: 'artifact org.kaakaa.sample:homeSample' could not be found on repository: remote, so will be created
[INFO] Uploading repository metadata for: 'artifact org.kaakaa.sample:homeSample'
[INFO] Uploading project information for homeSample 1.0
:uploadArchives (Thread[main,5,main]) completed. Took 3.839 secs.

BUILD SUCCESSFUL

Total time: 14.936 secs
Stopped 0 compiler daemon(s).

TracLightning側がディレクトリ作成の許可してないからなのかな?
設定どこだろう。