In our company there are many JEE backend applications which are deployed to jfrog artifactory. Each of this projects contains some dependency to other maven repository sources, which in turn have a lot of other dependencies. So when I use one of the dependencies, like
<project>
...
<dependencies>
<dependency>
<groupId>sample.ProjectA</groupId>
<artifactId>Project-A</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Sample.ProjectA.Project-A could have some commercial dependencies. I see that maven uses the licenses field to put license info
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
I also found a way to get the maven licenses with the reports info plugin maven-project-info-reports-plugin
Now it would be great, to tell maven to warn if there are any commercial licenses. Is there a possibility to do that?
There are a couple of Maven plugins that verify the licenses used by a project's dependencies:
However, there are problems with this approach:
<license>
in a dependency's POM using well known names or URLs for the licenses. Unfortunately, these are not standardized (as illustrated in the example "licenses.xml" files). It is up to you to figure out a way to deal with this.