Custom lib maven-publish


(Milan Vanca) #1

Codename One provides ant build script for creating libraries called .cn1lib. How to publish this library to maven repo?

This configuration does not work.

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

ant.importBuild('build.xml') {
    antTargetName -> 'ant-' + antTargetName
}

task createLib(dependsOn: 'ant-jar') {
    doLast {
        println 'Ant build from Gradle.'
    }
}

def myLib = artifacts.add('archives', file('dist/nordlicht-commons-mobile.cn1lib')) {
    builtBy('createLib')
}

publishing {
    repositories {
        maven {
            credentials {
                username "${artifactory_user}"
                password "${artifactory_password}"
            }
            url "${artifactory_contextUrl}/libs-release-local"
        }
    }
}

publishing {
    publications {
        foo(MavenPublication) {
            artifact myLib
            artifactId "nordlicht-commons-mobile"
            groupId 'com.nordlicht.nl'
            version '1.0'
        }
    }
}

Sadly it fails with this error:
Execution failed for task ':tasks'.
> Could not determine the dependencies of task ':assemble'.