lucky1928
lucky1928

Reputation: 8935

maven publish artifacts to local repository fail

I would like to test my publish task locally first before deploy it to maven server. I wish it can be deploy to local maven repository as below but it doesn't work

apply plugin: 'maven-publish'

publishing {
    repositories {
        maven {
            name 'release'
            url "/home/user/.m2/repository"
            credentials {
                username = ""
                password = ""
            }
        }
    }
    publications {
        deployApp(MavenPublication) {
            groupId "com.sample"
            artifactId "demo"
            version "1.0.0"
            artifact ("demo.apk")
        }
    }
}

What's the proper way to verify publish task locally?

Upvotes: 0

Views: 461

Answers (1)

PrasadU
PrasadU

Reputation: 2438

to locally publish you just need

publishing {
  publications {
    mavenJava(MavenPublication) {
      artifact bootJar //replace with your artefact
    }
  }
}

it defaults to /Users/username/.m2/repository

remove your repositories section

Upvotes: 1

Related Questions