add-third-party goal
Açıklaması şöyle
Generates a file containing a list of all dependencies and their licenses for a single project build.
prepare-package safhasında çalışır. Çıktıyı dosyasını thirdPartyFilename ve outputDirectory taglerini kullanarak değiştirebiliriz
Örnek
Şöyle yaparız
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.0.0</version>
<executions>
<execution>
<id>generate-third-party-report</id>
<phase>prepare-package</phase>
<goals>
<goal>add-third-party</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<thirdPartyFilename>THIRD-PARTY.txt</thirdPartyFilename>
</configuration>
</execution>
</executions>
</plugin>
target/generated-sources/license/THIRD-PARTY.txt yolundaki dosya şöyle
Lists of 5 third-party dependencies.(BSD) (The Apache Software License, Version 2.0) ArchUnit (com.tngtech.archunit:archunit:1.0.1 - https://github.com/TNG/ArchUnit)(Eclipse Public License 1.0) JUnit (junit:junit:4.13.2 - http://junit.org)(New BSD License) Hamcrest Core (org.hamcrest:hamcrest-core:1.3 - https://github.com/hamcrest/JavaHamcrest/hamcrest-core)(New BSD License) Hamcrest library (org.hamcrest:hamcrest-library:1.3 - https://github.com/hamcrest/JavaHamcrest/hamcrest-library)(MIT License) SLF4J API Module (org.slf4j:slf4j-api:1.7.36 - http://www.slf4j.org)
Örnek
Bir ara şöyle bir hata aldım
[INFO] Included licenses (whitelist): [CC0, Apache License, Version 2.0, MIT License, Public Domain, EPL 2.0, Eclipse Distribution License - v 1.0, BSD 3-Clause License, BSD 2-Clause License, The JSON License, Elastic License 2.0][WARNING] There are 1 forbidden licenses used:[WARNING] License: 'Eclipse Public License 1.0' used by 1 dependencies:-JUnit (junit:junit:4.13.2 - http://junit.org)
Yeni lisansı eklemek için şöyle yaparız
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>license-maven-plugin</artifactId> <executions> <execution> <id>add-third-party</id> <configuration>
<includedLicenses combine.children="append"> <includedLicense>Eclipse Public License 1.0</includedLicense> </includedLicenses>
</configuration> </execution> </executions> </plugin>
Daha sonra proje ilerledi ve bu sefer yeni bir lisans hatası aldım. Yeni lisansı eklemek için şöyle yaparız
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>license-maven-plugin</artifactId> <executions> <execution> <id>add-third-party</id> <configuration>
<includedLicenses combine.children="append"> <includedLicense>Eclipse Public License 1.0</includedLicense> <includedLicense>Eclipse Public License v2.0</includedLicense> </includedLicenses> </configuration>
</execution> </executions> </plugin>
license-list goal
Örnek
Çıktısı şöyle
[INFO] --- license:2.2.0:license-list (default-cli) @ hazelcast-jet-s3 ---[INFO] Adding a license repository jar:file:/D:/Users/user/.m2/repository/org/codehaus/mojo/license-maven-plugin/2.2.0/license-maven-plugin-2.2.0.jar!/META-INF/licenses[INFO] register GNU Free Documentation License (FDL) version 1.3[INFO] register GNU General Lesser Public License (LGPL) version 3.0[INFO] register GNU Affero General Public License (AGPL) version 3.0[INFO] register GNU General Public License (GPL) version 3.0[INFO] register GNU General Public License (GPL) version 2.0[INFO] register GNU General Public License (GPL) version 1.0[INFO] register Apache License version 2.0[INFO] register Eclipse Public License - v 2.0 with Secondary License[INFO] register Eclipse Public License - v 2.0[INFO] register Eclipse Public License - v 1.0[INFO] register Eclipse Public + Distribution License - v 1.0[INFO] register COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0[INFO] register GNU General Lesser Public License (LGPL) version 2.1[INFO] register MIT-License[INFO] register BSD 2-Clause License[INFO] register BSD 3-Clause License[INFO] register European Union Public License v1.1[INFO] Available licenses :* agpl_v3 : GNU Affero General Public License (AGPL) version 3.0* apache_v2 : Apache License version 2.0* bsd_2 : BSD 2-Clause License* bsd_3 : BSD 3-Clause License* cddl_v1 : COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0* epl_only_v1 : Eclipse Public License - v 1.0* epl_only_v2 : Eclipse Public License - v 2.0* epl_v1 : Eclipse Public + Distribution License - v 1.0* epl_v2 : Eclipse Public License - v 2.0 with Secondary License* eupl_v1_1 : European Union Public License v1.1* fdl_v1_3 : GNU Free Documentation License (FDL) version 1.3* gpl_v1 : GNU General Public License (GPL) version 1.0* gpl_v2 : GNU General Public License (GPL) version 2.0* gpl_v3 : GNU General Public License (GPL) version 3.0* lgpl_v2_1 : GNU General Lesser Public License (LGPL) version 2.1* lgpl_v3 : GNU General Lesser Public License (LGPL) version 3.0* mit : MIT-License
excludedGroups Tag
Şöyle yaparız
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.0.0</version>
<executions>
<execution>
<id>add-third-party</id>
<!-- We hook this plugin to the compile phase, you can change the phase -->
<phase>compile</phase>
<goals>
<goal>add-third-party</goal>
</goals>
<configuration>
<!-- Do not check our internal libraries -->
<excludedGroups>com.globalsport.*</excludedGroups>
<!-- Fail the build if the license is not Apache 2.0 or MIT. -->
<failOnBlacklist>true</failOnBlacklist>
<licenseMerges>
<!-- Aggreagate 'The Apache Software License, Version 2.0'. -->
<licenseMerge>The Apache Software License, Version 2.0|Apache2|
Apache-2.0|Apache 2|APL2|Apache 2.0|Apache License, Version 2.0|
The Apache License, Version 2.0|Apache Software License - Version 2.0|
the Apache License, ASL Version 2.0|ASL 2.0|Apache License 2.0|ASL, version 2
</licenseMerge>
<!-- Aggreagate 'The MIT License'. -->
<licenseMerge>The MIT License|
MIT license|The MIT License (MIT)|MIT License|MIT|MIT-style
</licenseMerge>
</licenseMerges>
<!-- This is our allowed list-->
<!-- If one of our library license is not one of those the build will fail -->
<includedLicenses>
<includedLicense>The Apache Software License, Version 2.0</includedLicense>
<includedLicense>The MIT License</includedLicense>
</includedLicenses>
</configuration>
</execution>
</executions>
</plugin>
Hiç yorum yok:
Yorum Gönder