Upload part of project as jar to maven repo without all dependencies?


(markus_fried) #1

Hi,

I export parts of my project as a separate jar which I upload to Nexus:

task pJar(type: Jar, dependsOn: compileJava) {
 includeEmptyDirs = false
 baseName = 'BankValidator'
 from sourceSets.main.output.classesDir
 include '**/de/service/util/BankValidatorFassade*'
 include '**/de/service/general/model/IbanCreationResponse*'
 include '**/de/service/general/model/IbanValidationResponse*'
 include '**/de/service/general/model/KontoValidationResponse*'
 include '**/de/service/model/BaseResponse*'
 include '**/de/service/model/ResultCode*'
}
  //
// declare necessary artifacts (jar)
//
artifacts {
 archives pJar
}
  //
// push artifacts to Nexus
//
uploadArchives {
 repositories {
    mavenDeployer {
    repository(url: "http://nexsr .... /snapshots") {
    authentication(userName: "something", password: "something")
    }
    addFilter('bankvalidator') {artifact, file ->
     artifact.ext == 'jar'
    }
    pom('bankvalidator').version =
"1.0-SNAPSHOT"
    pom('bankvalidator').artifactId = "bankvalidator"
    pom('bankvalidator').groupId = "de.something"
    uniqueVersion = false
    }
 }
}

This works, but the associated Pom gets ALL the dependendies of my project, which is unnecessary.

How can I exclude dependencies or even clear all from the POM?

Best regards Mark.