Hi, I need to publish around 60 jars generated during build process to artifactory. These jars are not containing compiled source code. These jars are artifacts of a tool which is invoked during CI build. How can i publish them to artifactory. Tried few options like
artifacts {
archives myJar
}
Where myjar is a task which will produce those jars by calling a groovy script. But no success.
Here is the content of my build.gradle. Maven plugin is used. Created an empty project called t. No source code is there.
artifacts {
archives file (‘PATH TO JAR’)
}
When i run the build file, getting below exception.
20:17:59.443 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
20:17:59.443 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ‘:install’.
20:17:59.443 [ERROR] [org.gradle.BuildExceptionReporter] > Could not publish configuration 'archives’
20:17:59.443 [ERROR] [org.gradle.BuildExceptionReporter] > A POM cannot have multiple artifacts with the same type and classifier. Already have MavenArtifact t:jar:jar:null, trying to add MavenArtifact t:jar:jar:null.
Hi, thanks for your response. If classifier is added then it works. But that still didn’t solve my problem. I need to publish around 60+jars generated out of build process. For each jar i really don’t have any unique classifiers. Only the jar name is different. They should have same group id and version.
Now i’m having two issues. One is i don’t have unique classifiers for each jar.
Second one is, the base archive name which is treated as artifact id, has to be changed for each jar. I don’t see any option to update the artifact id for each jar. Can you please help . thanks.
Hi, i tried giving “name” attribute. But that doesn’t impact the artifact name, in the artifactory, as well still classifier is needed to publish more than a jar.
Even with “name” attribute , project name is used as artifactid . I can’t use “archivesBaseName” to give unique artifact id to each jar.
Classifier is needed irrespective of “name” attribute usage.
Hmm, it looks like you’re right. The project name is always used. Artifact name is purely for display purposes. I’m not sure there’s a way to do this with the old ‘maven’ plugin. Using the ‘maven-publish’ plugin you could do something like.
Thanks for your post… can you please look at artifactory and see what is the artifact name for the jars that you published. Was it the project name aka baseArchiveName. Or each jar has its own artifact name.
Actually … I generate a series of bars(message broker using commandline …exec task… mqsicreatebar) and upload them in this build and artifactory also has the same name as the generated artifacts.
eg.,
LOS_AccRelMnt_CBSServicesAPP-1.0.bar and so on.