Maven plugin for license processing?

Since Maven pom may contain license information, is there a way you could, for example, tell your build that the "Apache v2" Licencses is ok, but the GPL, for example, is not, and when you create Maven, they will return errors, if necessary dependencies of prohibited licenses and, in the end, ask you to accept the unknown?

I know that there are available plugins that create a report on all used licenses in the project, but I could not find a single one that actually allows you to determine what is good and what is not, and ask for confirmation if it doesn’t know.

+4
source share
4 answers

I think I found the tool I was looking for: http://www.sonatype.com/clm/overview But the solution not only consists of the maven plugin, but also provides the services I was looking for, and even more.

0
source

Mojohaus (ex-Codehaus) has a fairly flexible and mature licensed plugin that should do the job.

+4
source

Are you looking for information on how to configure maven-license-plugin? Check this link

The following is an example of use:

<build> <plugins> <plugin> <groupId>com.mycila.maven-license-plugin</groupId> <artifactId>maven-license-plugin</artifactId> <configuration> <basedir>${basedir}</basedir> <header>${basedir}/src/etc/header.txt</header> <validHeaders> <validHeader>/otherSupportedHeader.txt</validHeader> <validHeader>http://www.company.com/yetAnotherSupportedHeader.txt</validHeader> </validHeaders> <quiet>false</quiet> <failIfMissing>true</failIfMissing> <aggregate>false</aggregate> <includes> <include>src/**</include> <include>**/test/**</include> </includes> <excludes> <exclude>target/**</exclude> <exclude>.clover/**</exclude> </excludes> <useDefaultExcludes>true</useDefaultExcludes> <mapping> <jwc>XML_STYLE</jwc> <application>XML_STYLE</application> <myFileExtension>JAVADOC_STYLE</myFileExtension> </mapping> <useDefaultMapping>true</useDefaultMapping> <properties> <year>${project.inceptionYear}</year> <email> my@email.com </email> </properties> <encoding>UTF-8</encoding> <headerDefinitions> <headerDefinition>def1.xml</headerDefinition> <headerDefinition>def2.xml</headerDefinition> </headerDefinitions> </configuration> <executions> <execution> <goals> <goal>check</goal> </goals> </execution> </executions> </plugin> </plugins> </build> 
0
source

In this case, I assume that you are talking about dependency licenses. To do this, you can look at the Maven License Verifier Plugin , which accurately verifies such things. Best if you look at the section.

0
source

Source: https://habr.com/ru/post/1436948/


All Articles