pivotal / LicenseFinder

Find licenses for your project's dependencies.
MIT License
1.73k stars 340 forks source link

Improve error message "No dependencies recognized!" #647

Open outsideMyBox opened 4 years ago

outsideMyBox commented 4 years ago

The error "No dependencies recognized!" is hard to debug. I'm stumbling upon this one for a basic Gradle (5.6) project and can't figure out what's wrong.
license_finder --debug should display more information about where the dependencies are looked for and what is expected.

build.gradle:

plugins {
    id "com.github.hierynomus.license" version "0.15.0"
}

Command:

license_finder --debug
LicenseFinder::GoModules: is not active
LicenseFinder::GoDep: is not active
LicenseFinder::GoWorkspace: is not active
LicenseFinder::Go15VendorExperiment: is not active
LicenseFinder::Glide: is not active
LicenseFinder::Gvt: is not active
LicenseFinder::Govendor: is not active
LicenseFinder::Trash: is not active
LicenseFinder::Dep: is not active
LicenseFinder::Bundler: is not active
LicenseFinder::NPM: is not active
LicenseFinder::Pip: is not active
LicenseFinder::Yarn: is not active
LicenseFinder::Bower: is not active
LicenseFinder::Maven: is not active
LicenseFinder::Gradle: is active
LicenseFinder::CocoaPods: is not active
LicenseFinder::Rebar: is not active
LicenseFinder::Nuget: is not active
LicenseFinder::Carthage: is not active
LicenseFinder::Mix: is not active
LicenseFinder::Conan: is not active
LicenseFinder::Sbt: is not active
LicenseFinder::Cargo: is not active
LicenseFinder::Dotnet: is not active
LicenseFinder::Composer: is not active
LicenseFinder::Gradle: no command defined

No dependencies recognized!

Version:

license_finder version
5.11.1
cf-gitbot commented 4 years ago

We have created an issue in Pivotal Tracker to manage this. Unfortunately, the Pivotal Tracker project is private so you may be unable to view the contents of the story.

The labels on this github issue will be updated when the story is started.

xtreme-shane-lattanzio commented 4 years ago

@outsideMyBox This would not be a trivial fix. We would need to add different reasoning for every package manager that LF supports. In this case, it looks like the problem is here: https://github.com/pivotal/LicenseFinder/blob/f24a5630db16448eb52f744f58ddf1ad97fccace/lib/license_finder/package_utils/gradle_dependency_finder.rb#L11

It is saying that there is no dependency-license.xml file created so there is no dependencies found. The plugin creating that file is found here: https://github.com/hierynomus/license-gradle-plugin

Not sure why it isn't creating one in your case.

zhixuan-loh commented 2 years ago

I faced the same issue of having "No dependencies recognized!". I'm using

gradlew: 6.8.3

However, I confirm that the dependency-license.xml has been generated in {projectRootFolder}/build/reports/license. @outsideMyBox you might wanna check for yourself if it is there. Just that for me, the xml file contains nothing, which explains the "No dependencies recognized!".

I checked that I included id "com.github.hierynomus.license" version "0.15.0" in my root level build.gradle file and that's all. I did not override any default arguments for the downloadLicense task.

But I'm stuck here. Have you guys fixed the issue?

xtreme-shane-lattanzio commented 2 years ago

FYI hierynomus has updated to 0.16.1. The original issue here is weird because it is saying that there is no gradle command given. The version they are using of license finder is very old though. What you can try is to specifically run the plugin by adding it to your gradle and running ./gradlew downloadLicenses If the xml is empty, its probably a problem with your build setup