Using version 3.1, I decided to split my build file with one file dedicated to pushing artifacts to artifactory. I created a new file artifactory.gradle and applying it from the main build file.
Am facing issues when I try to apply from: 'gradle-common/artifactory.gradle'. I understand that there is a known problem as described here.
But this is so inconvenient. I just am not able to locate the actual plugin class of artifactory plugin (The one I was using was a wrong plugin class). The source code of the plugin does not seem to be available anywhere, (So will be the case for numerous other plugin I suppose). I really hope Gradle team solves this known problem.
Any idea where the buildScript dependencies are downloaded ? So I can view the jar file and find out the class to use.
Somehow managed to find the plugin class. Now getting this error
* Where:
Script '/Users/sseshac/src/JenkinsTrial/src/repo/gradle-common/artifactory.gradle' line: 11
* What went wrong:
A problem occurred evaluating script.
> Failed to apply plugin [class 'org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin']
> Cannot cast object 'org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention@3676cb79' with class 'org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention' to class 'org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention'
Apparently I had two plugin definitions for artifactory that caused the issue. Removing it from the main build.gradle made that error go away, but newer errors.
Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method publishing() for arguments [artifactory_c6jal2wkvlz8vpzljcferxcwm$_run_closure1@57575bf] on root project 'api' of type org.gradle.api.Project.
at org.gradle.internal.metaobject.AbstractDynamicObject.methodMissingException(AbstractDynamicObject.java:182)
at org.gradle.internal.metaobject.AbstractDynamicObject.invokeMethod(AbstractDynamicObject.java:167)
This even though I have applied Maven plugin within artifactory.gradle.
apply plugin: org.gradle.api.plugins.MavenPlugin
apply plugin: org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin
Error goes away when I do include maven-publish in my main build.gradle
plugins {
//id “com.jfrog.artifactory” version "4.0.0"
id "java"
id “maven-publish”
}
Am beginning to think, this was a bad idea to split build files this way and probably useful only when you have pure methods that you want to re-use in gradle files.