使用 hierynomus 的 gradle 许可插件获得空许可报告
Got empty license reports with hierynomus' gradle license plugin
我正在 Gradle 项目上制作两个 android 应用程序,并使用 Hierynomus 的 gradle license plugin 管理依赖许可。
然后,我执行了以下命令:
$ ./gradlew downloadLicenses
$ cat ./build/reports/license/dependency-license.json
但是生成的许可证报告是空的。
{"dependencies":[]}
我尝试解决以下文档的问题:
- https://github.com/hierynomus/license-gradle-plugin/issues/81
- https://github.com/hierynomus/license-gradle-plugin/issues/103
- https://github.com/hierynomus/license-gradle-plugin/issues/137
- https://github.com/hierynomus/license-gradle-plugin/issues/174
但我无法解决问题。
接下来,我尝试使用 --refresh-dependencies
和 --rerun-tasks
选项执行任务。遗憾的是,问题并没有解决。
这些是我的构建脚本:
// build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.21'
ext.kotlin_coroutine_version = '1.1.1'
repositories {
google()
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.12.1'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.21.0'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "http://dl.bintray.com/jetbrains/spek" }
}
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.github.hierynomus.license'
downloadLicenses {
includeProjectDependencies = true
dependencyConfiguration = 'implementation'
ext.apacheTwo = license('Apache License, Version 2.0', 'https://opensource.org/licenses/Apache-2.0')
ext.bsd = license('BSD License', 'https://opensource.org/licenses/bsd-license')
aliases = [
(apacheTwo): [
'The Apache Software License, Version 2.0',
'Apache 2',
'Apache License Version 2.0',
'Apache License, Version 2.0',
'Apache License 2.0',
license('Apache License', 'https://www.apache.org/licenses/LICENSE-2.0')
],
(bsd): [
'BSD',
license('New BSD License', 'https://opensource.org/licenses/bsd-license')
]
]
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// app/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
defaultConfig {
applicationId "xyz.tech-frodo.testFirebaseApp.console"
minSdkVersion 26
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
lintConfig file("lint.xml")
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-firestore:18.1.0'
implementation 'com.github.kittinunf.fuel:fuel:1.12.0'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.9.4'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutine_version"
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-annotations:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'
// client/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "xyz.tech-frodo.testFirebaseApp.client"
minSdkVersion 27
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-firestore:18.1.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutine_version"
implementation 'com.github.kittinunf.fuel:fuel:1.12.0'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.9.4'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.maps:google-maps-services:0.9.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'org.jetbrains.spek:spek-api:1.1.5'
testImplementation 'org.jetbrains.spek:spek-junit-platform-engine:1.1.5'
testImplementation 'org.mockito:mockito-core:+'
testImplementation 'junit:junit:4.12'
testImplementation 'org.junit.platform:junit-platform-runner:1.1.0'
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
毫无疑问,我希望我的项目的依赖许可报告是在 ${PROJECT_ROOT}/build/reports/license/
下生成的。我发现生成了报告,但是这些报告是空的。
谢谢!
好像是0.15.0版本的问题Fix getting licenses on Android。
对我来说,它适用于版本 0.14.0 和一些额外的配置:
// buil.gradle root
plugins {
id "com.github.hierynomus.license" version "0.14.0"
}
downloadLicenses {
dependencyConfiguration = 'implementation'
includeProjectDependencies = true
}
// build.gradle app
apply plugin: 'com.github.hierynomus.license'
configurations.implementation.setCanBeResolved(true)
configurations.api.setCanBeResolved(true)
我正在 Gradle 项目上制作两个 android 应用程序,并使用 Hierynomus 的 gradle license plugin 管理依赖许可。 然后,我执行了以下命令:
$ ./gradlew downloadLicenses
$ cat ./build/reports/license/dependency-license.json
但是生成的许可证报告是空的。
{"dependencies":[]}
我尝试解决以下文档的问题:
- https://github.com/hierynomus/license-gradle-plugin/issues/81
- https://github.com/hierynomus/license-gradle-plugin/issues/103
- https://github.com/hierynomus/license-gradle-plugin/issues/137
- https://github.com/hierynomus/license-gradle-plugin/issues/174
但我无法解决问题。
接下来,我尝试使用 --refresh-dependencies
和 --rerun-tasks
选项执行任务。遗憾的是,问题并没有解决。
这些是我的构建脚本:
// build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.21'
ext.kotlin_coroutine_version = '1.1.1'
repositories {
google()
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.12.1'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.21.0'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "http://dl.bintray.com/jetbrains/spek" }
}
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.github.hierynomus.license'
downloadLicenses {
includeProjectDependencies = true
dependencyConfiguration = 'implementation'
ext.apacheTwo = license('Apache License, Version 2.0', 'https://opensource.org/licenses/Apache-2.0')
ext.bsd = license('BSD License', 'https://opensource.org/licenses/bsd-license')
aliases = [
(apacheTwo): [
'The Apache Software License, Version 2.0',
'Apache 2',
'Apache License Version 2.0',
'Apache License, Version 2.0',
'Apache License 2.0',
license('Apache License', 'https://www.apache.org/licenses/LICENSE-2.0')
],
(bsd): [
'BSD',
license('New BSD License', 'https://opensource.org/licenses/bsd-license')
]
]
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// app/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
defaultConfig {
applicationId "xyz.tech-frodo.testFirebaseApp.console"
minSdkVersion 26
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
lintConfig file("lint.xml")
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-firestore:18.1.0'
implementation 'com.github.kittinunf.fuel:fuel:1.12.0'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.9.4'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutine_version"
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-annotations:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'
// client/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "xyz.tech-frodo.testFirebaseApp.client"
minSdkVersion 27
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-firestore:18.1.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutine_version"
implementation 'com.github.kittinunf.fuel:fuel:1.12.0'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.9.4'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.maps:google-maps-services:0.9.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'org.jetbrains.spek:spek-api:1.1.5'
testImplementation 'org.jetbrains.spek:spek-junit-platform-engine:1.1.5'
testImplementation 'org.mockito:mockito-core:+'
testImplementation 'junit:junit:4.12'
testImplementation 'org.junit.platform:junit-platform-runner:1.1.0'
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
毫无疑问,我希望我的项目的依赖许可报告是在 ${PROJECT_ROOT}/build/reports/license/
下生成的。我发现生成了报告,但是这些报告是空的。
谢谢!
好像是0.15.0版本的问题Fix getting licenses on Android。
对我来说,它适用于版本 0.14.0 和一些额外的配置:
// buil.gradle root
plugins {
id "com.github.hierynomus.license" version "0.14.0"
}
downloadLicenses {
dependencyConfiguration = 'implementation'
includeProjectDependencies = true
}
// build.gradle app
apply plugin: 'com.github.hierynomus.license'
configurations.implementation.setCanBeResolved(true)
configurations.api.setCanBeResolved(true)