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

downloadLicenses fails in gradle 3.4.1 #134

Closed
serba opened this issue Apr 4, 2017 · 6 comments
Closed

downloadLicenses fails in gradle 3.4.1 #134

serba opened this issue Apr 4, 2017 · 6 comments

Comments

@serba
Copy link

serba commented Apr 4, 2017

We recently upgraded our project to gradle 3.4.1 and downloadLicenses started failing with the following exception:

Caused by: groovy.lang.MissingPropertyException: Could not get unknown property 'source' for object of type org.gradle.api.internal.artifacts.dependencies.DefaultSelfResolvingDependency.
	at org.gradle.internal.metaobject.AbstractDynamicObject.getMissingProperty(AbstractDynamicObject.java:88)
	at org.gradle.internal.metaobject.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:62)
	at org.gradle.api.internal.artifacts.dependencies.DefaultSelfResolvingDependency_Decorated.getProperty(Unknown Source)
	at nl.javadude.gradle.plugins.license.LicenseResolver$_provideFileDependencies_closure8.doCall(LicenseResolver.groovy:164)
	at nl.javadude.gradle.plugins.license.LicenseResolver.provideFileDependencies(LicenseResolver.groovy:162)
	at nl.javadude.gradle.plugins.license.LicenseResolver$_provideLicenseMap4Dependencies_closure2.doCall(LicenseResolver.groovy:84)
	at nl.javadude.gradle.plugins.license.LicenseResolver.provideLicenseMap4Dependencies(LicenseResolver.groovy:48)
	at nl.javadude.gradle.plugins.license.LicenseResolver$provideLicenseMap4Dependencies.call(Unknown Source)
	at nl.javadude.gradle.plugins.license.DownloadLicenses$_downloadLicenses_closure1.doCall(DownloadLicenses.groovy:103)
	at nl.javadude.gradle.plugins.license.DownloadLicenses$_downloadLicenses_closure1.doCall(DownloadLicenses.groovy)
	at java_util_concurrent_Callable$call.call(Unknown Source)
	at nl.javadude.gradle.plugins.license.DownloadLicenses.downloadLicenses(DownloadLicenses.groovy:113)

I noticed that DefaultSelfResolvingDependency.java had getSource method in gradle 2.14 and it’s not there in gradle 3.4.1. It looks like that was changed in 3.3 (see gradle/gradle@9e20cfe).

Should license-gradle-plugin call FileCollectionDependency.files or even FileCollectionDependency.resolve instead of FileCollectionDependency.source in LicenseResolver.groovy#L164 ?

@yduman
Copy link

yduman commented Apr 6, 2017

same issue here

@hierynomus
Copy link
Owner

Thanks for reporting this. I will have a look at this asap

@ejohansson
Copy link
Contributor

The proposed solution seems worked out for me.
Created a pull request #135

hierynomus pushed a commit that referenced this issue Apr 10, 2017
groovy.lang.MissingPropertyException: Could not get unknown property 'source' for object of type org.gradle.api.internal.artifacts.dependencies.DefaultSelfResolvingDependency.
@hierynomus
Copy link
Owner

Thanks @ejohansson!
I've merged the PR, and will release a new version shortly (ie. this week)

@imrimt
Copy link

imrimt commented Oct 2, 2018

Running into this issue again when I have this line in my project

project.dependencies {
    compile files("path/to/resources")
}

I'm on Gradle 4.10.

@robinson-calderon
Copy link

@imrimt to solve the problem you just need to change the compile to implementation

implementation(files('./src/main/resources/myjar.jar'))

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

No branches or pull requests

6 participants