Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from
Closed

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

wants to merge 1 commit into from

Conversation

ethankhall
Copy link

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
Copy link
Collaborator

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

@ethankhall
Copy link
Author

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
Copy link
Collaborator

hmmm, this breaks automatic configuration of the maven plugin.

@johnrengelman
Copy link
Collaborator

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
Copy link
Collaborator

Fixed by 6d18b90

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants