Retrieve the artifactId (generated by publish-maven) to use it later in the build

Hi,

I have a spring boot app that I want to publish 2 times. First as bootJar and then as a docker image.

The code to publish to maven repo is the following :

publishing {
    publications {
        mavenJava(MavenPublication) {
            version = '1.0.3-SNAPSHOT'
            from components.java
        }
    }

    repositories {
        maven {
            name = 'nexus'
            if (project.hasProperty('isRelease')) {
                url = "urltomaven-releases"
            } else {
                url = "urltomaven-snapshots"
            }
            credentials{
                username getProperty("nexusUser")
                password getProperty("nexusPassword")
            }
        }
    }
}

The artifact is deployed following maven standard as written in the logs :
Downloading: com/org/app1/1.0.3-SNAPSHOT/maven-metadata.xml
Uploading: com/org/app1/1.0.3-SNAPSHOT/app1-1.0.3-20190227.155853-5.jar

I want to retrieve “app1-1.0.3-20190227.155853-5” in the previous task to use it in my docker tag task. (It is better when artifact and docker image have the same timestamp :))

Do you know if it is possible ?

Thank you :slight_smile: