Build.gradle - error installing artifact

I am having problems publishing to local maks nexus storage.

I'll admit that I don't have much experience with gradle.

I'll say that I tried to understand the documentation and examples that are given via the gradle website (along with a few questions about the stack).

I am getting the following error when trying to post:

Execution failed for task ':publishMavenPublicationToMavenRepository'.

> Failed to publish publication 'maven' to repository 'maven'
   > Error deploying artifact 'com.myproject:myproject-sdk:jar': Error deploying artifact: Resource to deploy not found: File: http://git.site.com:8081/nexus/content/repositories/releases/com/myproject/myproject-sdk/3.0.0/myproject-sdk-3.0.0.jar does not exist

      

the whole build.gradle file looks like this:

apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'build-version'

buildscript {
    repositories {
        maven { url "http://git.site.com:8081/nexus/content/groups/public" }
        maven { url 'https://geonet.artifactoryonline.com/geonet/public-releases' }
        mavenCentral()
    }

    dependencies {
        classpath 'nz.org.geonet:gradle-build-version-plugin:1.+'
    }
}

repositories {
    maven {
        url "http://git.site.com:8081/nexus/content/groups/public"
    }
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'commons-codec:commons-codec:1.9'
}

task sourceJar(type: Jar) {
    from sourceSets.main.allJava
}

publishing {
    publications {
        maven(MavenPublication) {
            artifactId = 'myproject-sdk'
            groupId = 'com.myproject'
            version '3.0.0'
            from components.java

            artifact sourceJar {
                classifier "sources"
            }
        }
    }

    repositories {
        maven {
            // nexus maven credentials
            credentials {
                username "MY_USERNAME"
                password ""MY_PASSWORD"
            }

            if(version.endsWith('-SNAPSHOT')) {
                url "http://git.site.com:8081/nexus/content/repositories/snapshots"
            } else {
                url "http://git.site.com:8081/nexus/content/repositories/releases"
            }
        }
    }
}

      

I am using Android Studio and this project is a Java project.

I don't understand the message because it says "Resource for deployment not found" and it points to the url in nexus.

I would expect a message like "Deployment resource not found: File: c: /directory_that_doesn't_exist/whatever.jar"

More information - The gradle tasks listed under All Tasks:

assemble
build
buildDependents
buildNeeded
check
classes
clean
compileJava
compileTestJava
generatePomFileForMavenPublication
jar
javadoc
processResources
processTestResources
publish
publishMavenPublicationToMavenLocal
publishMavenPublicationToMavenRepository
publishToMavenLocal
sourceJar
test
testClasses

      

+3


source to share





All Articles