I have a custom gradle plugin that adds custom task types and gradle to it. When I apply this plugin before maven-publish , it works fine. But when I add it after apply plugin: 'maven-publish' , it crashes with an error message:
FAILURE: Build failed with an exception. * Where: Build file '/scratch/skgupta/git_storage/emdi/integtest/build.gradle' line: 38 * What went wrong: A problem occurred evaluating root project 'integtest'. > Cannot configure the 'publishing' extension after it has been accessed. * Try: Run with
Here is the build.gradle file.
buildscript { repositories { maven { url = "${artifactory_contextUrl}/repo" } } dependencies { classpath group: 'com.mycomp.proj', name: 'MyCustomPlugin', version: "${pluginVersion}", transitive: true } } apply plugin: 'java' apply plugin: 'maven-publish' apply plugin: 'MyCustomPlugin' // WHen this line is moved above maven-publish, build works fine. // add jar name and version jar.archiveName='lrgemaas_small_deploy_3n.jar' group = 'com.mycom.proj.test' version = '1.0.3' dependencies { compile group: 'eaas.platform', name: 'registry-lookup-client', version: '0.1' compile group: 'eaas.platform', name: 'registry-client', version: '0.1' compile configurations.lrgConfig // This configuration is added by MyCustomPlugin compile configurations.webdriver // This configuration is added by MyCustomPlugin } repositories { maven { url = "${artifactory_contextUrl}/repo" } } publishing { publications { myPublicationName(MavenPublication) { artifactId 'lrgemaas_small_deploy_3n' artifact jar.archivePath } } repositories { maven { url = "${artifactory_contextUrl}/${artifactory_repoName}" credentials { username = "${artifactory_user}" password = "${artifactory_password}" } } } } // workflow for build defaultTasks 'clean','build','publish'
PS: I tried to do nothing in the user plugin (i.e. just return from the apply method), but it still gives the same error.
source share