Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.pine:license-tools-plugin:v0.16.0'
}
dependencies {
implementation("com.github.pine:license-tools-plugin:v0.16.0")
}
<dependency>
<groupId>com.github.pine</groupId>
<artifactId>license-tools-plugin</artifactId>
<version>v0.16.0</version>
</dependency>
libraryDependencies += "com.github.pine" % "license-tools-plugin" % "v0.16.0"
:dependencies [[com.github.pine/license-tools-plugin "v0.16.0"]]
Gradle Plugin to check library licenses and generate license pages.
./gradlew checkLicenses
to check licenses in dependencies./gradlew generateLicensePage
to generate a license page licenses.html
./gradlew generateLicenseJson
to generate a license json file licenses.json
This plugin requires JDK8 (1.8.0 or later).
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.cookpad.android.licensetools:license-tools-plugin:0.16.0'
}
}
apply plugin: 'com.cookpad.android.licensetools'
See [example/build.gradle] for example.
checkLicenses
taskYou will see the following messages by ./gradlew checkLicenses
:
# Libraries not listed:
- artifact: com.android.support:support-v4:+
name: #NAME#
copyrightHolder: #AUTHOR#
license: No license found
- artifact: com.android.support:animated-vector-drawable:+
name: #NAME#
copyrightHolder: #AUTHOR#
license: No license found
- artifact: io.reactivex:rxjava:+
name: #NAME#
copyrightHolder: #AUTHOR#
license: apache2
app/licenses.yml
Then, Create app/licenses.yml
, and add libraries listed the above with required fields:
- artifact: com.android.support:+:+
name: Android Support Libraries
copyrightHolder: The Android Open Source Project
license: apache2
- artifact: io.reactivex:rxjava:+
name: RxJava
copyrightHolder: Netflix, Inc.
license: apache2
You can use wildcards in artifact names and versions.
You'll know the Android support libraries are groupd in com.android.support
so you use com.android.support:+:+
here.
Then, ./gradlew checkLicenses
will passes.
licenses.html
by the generateLicensePage
task./gradlew generateLicensePage
generates app/src/main/assets/licenses.html
.
This plugin does not provide Activity
nor Fragment
to show licenses.html
. You should add it by yourself.
example/MainActivity
is an example.
artifact
name
copyrightHolder
, author
, authors
or notice
year
to indicate copyright yearsskip
to skip generating liense entries (for proprietary libraries)- artifact: com.android.support:+:+
name: Android Support Libraries
copyrightHolder: The Android Open Source Project
license: apache2
- artifact: org.abego.treelayout:org.abego.treelayout.core:+
name: abego TreeLayout
copyrightHolder: abego Software
license: bsd_3_clauses
- artifact: io.reactivex:rxjava:+
name: RxJava
copyrightHolder: Netflix, Inc.
license: apache2
- artifact: com.tunnelvisionlabs:antlr4-runtime:4.5
name: ANTLR4
authors:
- Terence Parr
- Sam Harwell
license: bsd_3_clauses
- artifact: com.github.gfx.android.orma:+:+
name: Android Orma
notice: |
Copyright (c) 2015 FUJI Goro (gfx)
SQLite.g4 is: Copyright (c) 2014 by Bart Kiers
license: apache_2
- artifact: io.reactivex:rxandroid:1.1.0
name: RxAndroid
copyrightHolder: The RxAndroid authors
license: apache2
- artifact: license-tools-plugin:example-dep:+
skip: true
To bump versions:
./gradlew bumpPatch
./gradlew bumpMinor
./gradlew bumpMajor
To test artifacts:
make check
To publish artifacts:
make publish
Keep CHANGES.md
up-to-date.
Copyright (c) 2016 Coopkad Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.