I am having a very difficult time figuring out how to get the Gradle Artifactory plugin to properly publish multiple .jar files from a single project.
I am able to build both jars fine in Gradle. It's just the artifactory publish step that is problematic. I realize that this is addressed somewhat indirectly both here: http://www.jfrog.com/confluence/display/RTF/Gradle+Artifactory+Plugin+using+the+snapshot+version and here: http://www.gradle.org/docs/current/userguide/maven_plugin.html#multiple_artifacts_per_project But not in a sufficient way that I've been able to get things to work. I'm not going to yet post my entire build file, as I've tried so many different variants, and I'm not sure which one to post. I first wanted to just check on the overall strategy. In my iteration that is closest to working, I put both jars in the same "archives" configuration, and differentiate the two using the 'classifier' field: --- begin --- artifacts { archives (jarServer.archivePath) { name = projectName type = 'jar' classifier = 'server' } archives (jarAndroid.archivePath) { name = projectName type = 'jar' classifier = 'android' } } --- end --- But in this case I get a single .pom file, and it doesn't have the dependency information for either of them. I assume that if I want proper dependence info, there ought to be separate .pom files, one for each .jar file? If I instead try to differentiate based on the name, I don't think it's working. It appears that it's not accepting the name setting below: --- begin --- artifacts { archives (jarServer.archivePath) { name = projectName + '-server' type = 'jar' } archives (jarAndroid.archivePath) { name = projectName + '-android' type = 'jar' } } --- end --- as I get the following error: --- begin --- * What went wrong: Execution failed for task ':install'. > Could not publish configuration 'archives' > A POM cannot have multiple artifacts with the same type and classifier. Already have MavenArtifact http_java-server:jar:jar:null, trying to add MavenArtifact http_java-server:jar:jar:null. --- end --- So then I tried having separate archives* configurations for each jar, rather than a single "archives" configuration. Excerpts of the build include the following: --- begin --- configurations { archivesServer archivesAndroid } artifacts { archivesServer jarServer archivesAndroid jarAndroid } artifactoryPublish { publishConfigs('archivesServer') publishConfigs('archivesAndroid') } --- end --- Now I get the following error: --- begin --- Publishing to repository 'mavenInstaller' [ant:null] Error reading settings file '/tmp/gradle_empty_settings2738760698096986778.xml' - ignoring. Error was: /tmp/gradle_empty_settings2738760698096986778.xml (No such file or directory) --- end --- and: --- begin --- * What went wrong: A problem was found with the configuration of task ':artifactoryPublish'. > File '/var/tmp/rich/build/http_java/3.0/poms/pom-default.xml' specified > for property 'mavenDescriptor' does not exist. --- end --- It's worth noting here that earlier I had added the following code to my build.gradle, to prevent from generating (and publishing) a useless jar that was neither the server nor android case: --- begin --- // we don't want to end up with a nearly empty (manifest only) // jar file from the default jar task jar.enabled = false // and we don't want to publish it configurations.archives.artifacts.removeAll { it.archiveTask.is jar } --- end --- If I now comment these out, I'm (mostly) back to where I was before. Both jars are published to artifactory, but still with a single pom file that has dependencies for neither. There are some other problems as well with respect to the naming of the files within artifactory, but I figured I should deal with the major issues before worrying about the minor ones. I eventually want to have multiple jars be published from gradle multi-project builds as well, but that's not what I'm doing here. I was hoping that the single project build case would be an easier starting point, and that the knowledge of getting that to work would help for the multi-project ase as well. Oh yeah, I've also looked at the "gradle-example" at: https://github.com/JFrogDev/project-examples but I haven't managed to figure things out from that either. I'd be most appreciative of any help, either with the overall strategy that's appropriate here, or specific suggestions, or a pointer to some other docs or examples. Thanks. -- View this message in context: http://forums.jfrog.org/Publishing-multiple-jars-with-the-Gradle-Artifactory-plugin-tp7579584.html Sent from the Artifactory - Users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk _______________________________________________ Artifactory-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/artifactory-users
