9

I'm using the oss-licenses plugin (Android - Including Open Source Notices) for my Android app to gather the license information from all the open source repositories being used.

But some publishers have not included the <licenses> tag in their repository's POM file. This is why the plugin won't find the license file and these libraries are missing when using OssLicensesMenuActivity to display the listing.

Is there a way to enter additional entries for OssLicensesMenuActivity?

neatchuck
  • 731
  • 4
  • 14

1 Answers1

0

There is still no easy way to do this. However, there is an open merge request that would add this feature.

Anyway, I solved it with a workaround. First, create an empty library and publish it to your local maven(or some other maven repo), and then add the library as a dependency. You can publish the library to the local maven repo using this plugin.

The gradle file of the library would look like this:

publishing {
    publications {
        release(MavenPublication) {
            groupId = "com.stephan"
            artifactId = "mylib"
            version = "1.0.0"

            pom {
                name = 'The name I want to show in the list'
                licenses {
                    license {
                        name = 'The license'
                        url = 'https://url.to.license'
                    }
                }
            }
        }
    }
}

And the command to publish to the local maven repo: ./gradlew :nameoflibmodule:publishToMavenLocal

In the app project this can be easily added as a dependency with the usual implementation 'com.stephan:mylib:1.0.0' (also add mavenLocal() to the repositories in the build file)

The library can be empty, the only important part is that there is a pom file containing a <licenses> element. This can be verified by looking into the local maven repo at $USER_HOME/.m2/repositories/

For my example this would be $USER_HOME/.m2/repository/com/stephan/mylib/1.0.0/mylib-1.0.0.pom

Stephan
  • 15,704
  • 7
  • 48
  • 63