How to publish multiple artifacts with different group using gradle?

John Viernes IV

I have 2 artifacts I want to push. first one is a tar ball called myTarBall-1.1.tar.gz second one is a jar file myJarFile-1.1.jar

I want to push myTarBall-1.1.tar.gz into nexus to the following location com.sample.location.abc. I then want to push myJarFile-1.1.jar into nexus to the following location com.sample.location.xyz.

How would I go about doing that?

Thus far, I am only successful in pushing the myTarBall-1.1.tar.gz to com.sample.location.abc, but I can't figure out how to push myJarFile-1.1.jar to com.sample.location.xyz...

Any help would be appreciated...

Below is my build.gradle file:

plugins 
{
    id 'maven-publish'
}

group = "com.sample.location.abc"
version = "1.1"
def artifact_tar = 'myTarBall'
def artifact_jar = 'myJarFile'

publishing {
    publications {
        maven(MavenPublication) {
            groupId = "${project.group}"
            artifactId = "${artifact_tar}"
            version = "${version}"
            artifact source: "${artifact_tar}-${version}.tar.gz", extension: "tar.gz"

            ??? How to also push myJarFile-1.1.jar to com.sample.location.xyz in here???
        }
    }
}
John Viernes IV

In order to be able to push artifacts to different groups, I simply needed to add a new publication, which was suggested by @user16358266

publishing {
    publications {
        mavenOne(MavenPublication) {
            groupId = "${project.group}"
            artifactId = "${artifact_tar}"
            version = "${version}"
            artifact source: "${artifact_tar}-${version}.tar.gz", extension: "tar.gz" 
        }
    mavenTwo(MavenPublication) {
            groupId = "${**new.group.id**}"
            artifactId = "${artifact_jar}"
            version = "${version}"
            artifact source: "${artifact_jar}-${version}.jar", extension: "jar" 
        }
    }
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Gradle Artifactory Plugin - How to publish artifacts from multiple modules in a project?

Unable to publish artifacts to Nexus maven repository using Gradle

How can I publish a specific subset of artifacts in Gradle

How to publish and download artifacts from multiple jobs into one location on pipeline?

How to publish proguard JAR as Maven Artifact using Gradle Publish Plugin

Release definition to publish nuget packages for multiple artifacts

Android Library - Publish Multiple Variants to Local Maven Repository using Gradle

How to publish custom artifacts to Artifactory from TeamCity?

How to manually publish a file to Azure Artifacts?

How to use artifactoryPublish to publish release and debug artifacts

How to build and publish single JAR for multiple Gradle modules

How to group multiple dependency in same line - Gradle

How to publish multiple messages to single queue with different routing key in RabbitMQ?

Publish kotlin multiplatform library to Maven Central (InvalidMavenPublicationException multiple artifacts with the identical ...)

Delete and/or Replace Artifacts in Nexus using Gradle

Can Gradle upload different artifacts to different Maven repos?

Using Gradle to publish jars to MavenLocal

How to publish a shadow jar with an empty pom using gradle maven-publish plugin and Kotlin DSL?

Archive / publish artifacts to a Samba share using Jenkins pipeline

Pandas: How to group multiple row by different criteria

How get multiple SUM() for different columns with GROUP BY

How do you create additional jar artifacts from compiled classes using Gradle?

How to get a java jar file to publish to artifacts section in azure devops?

How to publish Travis CI artifacts to GitHub Release from several jobs

How to deploy an artifact from group of artifacts to jfrog artifactory using jenkins post build action

Publish multiple Gradle modules in one Maven artifact

pandas: how to group by multiple columns and perform different aggregations on multiple columns?

gradle publish does not pick up artifacts: "Task has not declared any outputs despite executing actions."

Gradle and Android : pom configuration with multiple Maven artifacts publication