Making plugin with with Gradle 3.1 and non Maven projects #256

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
@ethankhall
Contributor

ethankhall commented Oct 7, 2016

Fixing issue where plugin would end up throwing

Caused by: groovy.lang.MissingPropertyException: Could not get unknown property 'mavenDeployer' for repository container.
        at org.gradle.internal.metaobject.AbstractDynamicObject.getMissingProperty(AbstractDynamicObject.java:92)
        at org.gradle.internal.metaobject.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:62)
        at org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler_Decorated.getProperty(Unknown Source)
        at com.github.jengelman.gradle.plugins.shadow.ShadowJavaPlugin$1.execute(ShadowJavaPlugin.groovy:74)
        at com.github.jengelman.gradle.plugins.shadow.ShadowJavaPlugin$1.execute(ShadowJavaPlugin.groovy)
        at org.gradle.configuration.project.DelayedConfigurationActions.execute(DelayedConfigurationActions.java:27)
        at org.gradle.configuration.project.DelayedConfigurationActions.execute(DelayedConfigurationActions.java:22)
@johnrengelman

This comment has been minimized.

Show comment
Hide comment
@johnrengelman

johnrengelman Oct 8, 2016

Owner

this simply breaks in Gradle 3.1 or only when certain things are applied?

Owner

johnrengelman commented Oct 8, 2016

this simply breaks in Gradle 3.1 or only when certain things are applied?

@ethankhall

This comment has been minimized.

Show comment
Hide comment
@ethankhall

ethankhall Oct 8, 2016

Contributor

It appears not. I tested it on 3.1, 3.0 and 2.14.1 and they all ended up failing. I have a simple example project that causes the error.

plugins {
  id 'java'
  id 'com.github.johnrengelman.shadow' version '1.2.3'
}

configurations.each { configuration ->
  def upload = project.getTasks().getByName(configuration.getUploadTaskName())
  upload.repositories.ivy {
    layout 'ivy'
    url "$buildDir/repo"
  }
}

If you read the docs for RepositoryHandler it says that the mavenDeployer() is added by the maven plugin, so it probably its not accessible in this case.

If I update the example and use the local build I have (without the if(mavenPlugin) part) I still get the exception.

* What went wrong:
A problem occurred configuring root project 'tmp'.
> Could not find method mavenDeployer() for arguments [] on repository container.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

However when I add the maven plugin specifically the build works. Given the working example, if I switch back to the public version of the plugin I again get

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'tmp'.
> Could not get unknown property 'mavenDeployer' for repository container.

If I re-add the if(mavenPlugin) part of the patch and remove the apply plugin: 'maven' the build works against my local copy.

Contributor

ethankhall commented Oct 8, 2016

It appears not. I tested it on 3.1, 3.0 and 2.14.1 and they all ended up failing. I have a simple example project that causes the error.

plugins {
  id 'java'
  id 'com.github.johnrengelman.shadow' version '1.2.3'
}

configurations.each { configuration ->
  def upload = project.getTasks().getByName(configuration.getUploadTaskName())
  upload.repositories.ivy {
    layout 'ivy'
    url "$buildDir/repo"
  }
}

If you read the docs for RepositoryHandler it says that the mavenDeployer() is added by the maven plugin, so it probably its not accessible in this case.

If I update the example and use the local build I have (without the if(mavenPlugin) part) I still get the exception.

* What went wrong:
A problem occurred configuring root project 'tmp'.
> Could not find method mavenDeployer() for arguments [] on repository container.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

However when I add the maven plugin specifically the build works. Given the working example, if I switch back to the public version of the plugin I again get

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'tmp'.
> Could not get unknown property 'mavenDeployer' for repository container.

If I re-add the if(mavenPlugin) part of the patch and remove the apply plugin: 'maven' the build works against my local copy.

@johnrengelman

This comment has been minimized.

Show comment
Hide comment
@johnrengelman

johnrengelman Nov 2, 2016

Owner

hmmm, this breaks automatic configuration of the maven plugin.

Owner

johnrengelman commented Nov 2, 2016

hmmm, this breaks automatic configuration of the maven plugin.

@johnrengelman

This comment has been minimized.

Show comment
Hide comment
@johnrengelman

johnrengelman Nov 2, 2016

Owner

I've merged this change in the https://github.com/johnrengelman/shadow/tree/shadow_1.2.4 and then fixed it up a bit. Waiting on another report and then I'll release a 1.2.4.

Owner

johnrengelman commented Nov 2, 2016

I've merged this change in the https://github.com/johnrengelman/shadow/tree/shadow_1.2.4 and then fixed it up a bit. Waiting on another report and then I'll release a 1.2.4.

@johnrengelman johnrengelman added this to the 1.2.4 milestone Nov 3, 2016

@johnrengelman

This comment has been minimized.

Show comment
Hide comment
Owner

johnrengelman commented Nov 3, 2016

Fixed by 6d18b90

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment