Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write Excel files with extensive License Information (inc. infos from the JARs) #527

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
161073a
Line endings automatically updated conforming to settings
Nov 14, 2019
528becb
Small code cleanups
Nov 14, 2019
3e151ca
Option for aggregate-download-licenses for extended artifacts infos
Nov 14, 2019
5c78f01
Added output as Excel file in OOXML format.
Nov 15, 2019
ff1f8f3
Cleaned up license aggregation report Excel file
Nov 17, 2019
441c6e0
Excel report cleaner formatting
Nov 18, 2019
8206257
Extended license information logs the zip file name which couldn't be…
Nov 18, 2019
51fc6c1
License file checksum generation replaces http with https
Nov 19, 2019
214c9ad
Generated Excel file had a too low contrast alternating rows color
Nov 19, 2019
8fd0218
Update README.md to explain this Maven License Plugin fork.
Mar 1, 2022
a37d008
ISSUE-145 test fixed, it used an outdated Java version
May 31, 2022
af22db1
ANTLR license website checksum updated to current checksum
May 31, 2022
f5b3461
maven-wrapper.jar updated
May 31, 2022
61b2ee1
Create maven CI file
May 31, 2022
d59d93d
test.crlf.sh added missing newline at end-of-file
May 31, 2022
911407c
GitHub continues integration (CI) badge added
May 31, 2022
1217989
test.crlf.sh fixed line endings
May 31, 2022
514741d
test.crlf.sh line endings fixed through changing .gitattributes
May 31, 2022
7edfef6
README.md annotation added
May 31, 2022
54aed69
Improved README.md formatting
Sep 24, 2023
8a34707
Merged latest version from original project / repository
Sep 24, 2023
634c01f
Merged latest version from original project / repository
Oct 3, 2023
3b9b2c9
Added license merge to `license:aggregate-download-licenses` and Libr…
Oct 22, 2023
4bf1328
Merged latest origin master-branch
Oct 28, 2023
f52d6e6
Fixed removal of Nullable / NotNull annotations from maven dependencies
Oct 28, 2023
0fc2871
Fixed and added error reports to Excel and Calc export
Oct 28, 2023
335fc21
Fixed error in Excel and Calc files, using the wrong column with disa…
Oct 28, 2023
ca02c09
Formatting in LicenseSummaryTest fixed
Oct 28, 2023
6736ce8
Converting form-feed control characters to newlines
Oct 29, 2023
8531502
Updated the version number examples in the README.md
Oct 29, 2023
91afb4b
Removed tracking README.md from git for pull-request
Oct 29, 2023
7a818ae
Replaced README.md with original file
Oct 29, 2023
b2b5e07
Removed "run-one-it" profile, use "-P run-its -Dinvoker.test=<TestNam…
Nov 2, 2023
3251970
Merge branch 'master' into feature/pullRequest
Nov 2, 2023
a00f178
Code cleanups, following https://github.com/mojohaus/license-maven-pl…
Nov 13, 2023
f2fe78d
Merge remote-tracking branch 'original_repo/master' into feature/pull…
Nov 16, 2023
fd62d4f
licenses.xsd fixes and tests for it
Nov 19, 2023
25cc518
useXsd removed
Dec 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,28 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

<!-- Needed for extended constants in JARs MANIFEST.MF -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>6.0.0</version>
</dependency>

<!-- Microsoft Excel XLSX export -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.4</version>
</dependency>

<!-- LibreOffice Calc ODT export -->
<dependency>
<groupId>org.odftoolkit</groupId>
<artifactId>odfdom-java</artifactId>
<!-- There are later versions, but that versions need JDKs after version 8 -->
<version>0.9.0</version>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -363,7 +385,7 @@
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java17</artifactId>
<artifactId>java18</artifactId>
slawekjaranowski marked this conversation as resolved.
Show resolved Hide resolved
<version>1.0</version>
</signature>
</configuration>
Expand Down Expand Up @@ -492,6 +514,25 @@
<projectVersion>${project.version}</projectVersion>
</scriptVariables>
</configuration>
<dependencies>
<!-- Microsoft Excel XLSX export -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.4</version>
</dependency>
<!-- LibreOffice Calc ODT export -->
<dependency>
<groupId>org.odftoolkit</groupId>
<artifactId>odfdom-java</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.13.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>all-integration-test</id>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
License Maven Plugin
%%
Copyright (C) 2008 - 2011 CodeLutin, Codehaus, Tony Chemit
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Lesser Public License for more details.

You should have received a copy of the GNU General Lesser Public
License along with this program. If not, see
<http://www.gnu.org/licenses/lgpl-3.0.html>.
#L%
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.codehaus.mojo.license.test</groupId>
<artifactId>test-aggregate-download-licenses-extended-excel</artifactId>
<version>@project.version@</version>
</parent>
<artifactId>test-aggregate-download-licenses-extended-spreadsheet-child1</artifactId>

<name>License Test :: aggregate-download-licenses - Extended Spreadsheet — child 1</name>

<dependencies>

<!-- use license 'The Apache Software License, Version 2.0' -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<version>3.35.0</version>
</dependency>
</dependencies>

</project>


Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
License Maven Plugin
%%
Copyright (C) 2008 - 2011 CodeLutin, Codehaus, Tony Chemit
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Lesser Public License for more details.

You should have received a copy of the GNU General Lesser Public
License along with this program. If not, see
<http://www.gnu.org/licenses/lgpl-3.0.html>.
#L%
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.codehaus.mojo.license.test</groupId>
<artifactId>test-aggregate-download-licenses-extended-excel</artifactId>
<version>@project.version@</version>
</parent>
<artifactId>test-aggregate-download-licenses-extended-spreadsheet-child2</artifactId>

<name>License Test :: aggregate-download-licenses - Extended Spreadsheet — child 2</name>

<dependencies>

<!-- use license 'Apache License, Version 2.0' -->
<dependency>
<groupId>com.jhlabs</groupId>
<artifactId>filters</artifactId>
<version>2.0.235</version>
</dependency>

<!-- use license 'Apache Public License 2.0' -->
<dependency>
<groupId>org.sonatype.plexus</groupId>
<artifactId>plexus-cipher</artifactId>
<version>1.7</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.0</version>
</dependency>
</dependencies>

</project>


Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
###
# #%L
# License Maven Plugin
# %%
# Copyright (C) 2008 - 2011 CodeLutin, Codehaus, Tony Chemit
# %%
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Lesser Public License for more details.
#
# You should have received a copy of the GNU General Lesser Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/lgpl-3.0.html>.
# #L%
###
invoker.goals=clean license:aggregate-download-licenses
invoker.failureBehavior=fail-fast
77 changes: 77 additions & 0 deletions src/it/aggregate-download-licenses-extended-spreadsheet/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
License Maven Plugin
%%
Copyright (C) 2008 - 2011 CodeLutin, Codehaus, Tony Chemit
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Lesser Public License for more details.

You should have received a copy of the GNU General Lesser Public
License along with this program. If not, see
<http://www.gnu.org/licenses/lgpl-3.0.html>.
#L%
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>org.codehaus.mojo.license.test</groupId>
<artifactId>test-aggregate-download-licenses-extended-excel</artifactId>
<version>@project.version@</version>

<modules>
<module>child1</module>
<module>child2</module>
</modules>

<name>License Test :: aggregate-download-licenses - Extended Spreadsheet</name>

<packaging>pom</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<license.verbose>true</license.verbose>
</properties>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<extendedInfo>true</extendedInfo>
<writeCalcFile>true</writeCalcFile>
<writeExcelFile>true</writeExcelFile>
<licenseMerges>
<licenseMerge>The Apache Software License, Version 2.0|Apache License, Version 2.0|Apache Public License
2.0
</licenseMerge>
</licenseMerges>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

<dependencies>
<dependency>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core</artifactId>
<version>9.2.0.74516</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* #%L
* License Maven Plugin
* %%
* Copyright (C) 2008 - 2011 CodeLutin, Codehaus, Tony Chemit
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
* #L%
*/

import org.odftoolkit.odfdom.doc.OdfSpreadsheetDocument
import org.odftoolkit.odfdom.doc.table.OdfTable

import java.util.logging.Level
import java.util.logging.Logger

import org.apache.poi.ss.usermodel.Cell
import org.apache.poi.ss.usermodel.CellType
import org.apache.poi.ss.usermodel.Row
import org.apache.poi.ss.usermodel.Sheet
import org.apache.poi.ss.usermodel.Workbook
import org.apache.poi.ss.usermodel.WorkbookFactory

log = Logger.getLogger("test-aggregate-download-licenses-extended-spreadsheet")

static boolean searchTextInExcel(Sheet sheet, String searchText) {
def log2 = Logger.getLogger("test-aggregate-download-licenses-extended-spreadsheet-search")

for (Iterator<Row> rowIterator = sheet.rowIterator(); rowIterator.hasNext();) {
Row row = rowIterator.next()
for (Iterator<Cell> cellIterator = row.cellIterator(); cellIterator.hasNext();) {
Cell cell = cellIterator.next()
if (cell.cellType == CellType.STRING || cell.cellType == CellType.BLANK) {
def cellValue = cell.stringCellValue
if (cellValue == searchText) {
return true
} else {
log2.log(Level.FINEST, "Cell Value: {0}", cellValue)
}
}
}
}
return false
}

// -------------- Excel ----------------------
excelFile = new File(basedir, 'target/generated-resources/licenses.xlsx')
assert excelFile.exists()
assert excelFile.length() > 100

try (InputStream input = new FileInputStream(excelFile)) {
// So it can be easily opened and inspected manually. In a modern IDE it's just a (double-)click in the log output.
log.log(Level.FINE, "Excel export at: {}", excelFile.absolutePath)
Workbook workbook = WorkbookFactory.create(input)
Sheet sheet = workbook.getSheetAt(0)

assert searchTextInExcel(sheet, "Maven information")
assert searchTextInExcel(sheet, "The Apache Software License, Version 2.0")
assert searchTextInExcel(sheet, "The Apache Software Foundation")
}

// -------------- Calc -----------------

calcFile = new File(basedir, 'target/generated-resources/licenses.ods')
assert calcFile.exists()
assert calcFile.length() > 100

try (OdfSpreadsheetDocument spreadsheet = OdfSpreadsheetDocument.loadDocument(calcFile)) {
// So it can be easily opened and inspected manually. In a modern IDE it's just a (double-)click in the log output.
log.log(Level.FINE, "Calc export at: {}", calcFile.absolutePath)
List<OdfTable> tableList = spreadsheet.getTableList()
OdfTable table = tableList.get(0)
assert table.getRowCount() >= 3
}
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ public abstract class AbstractAddThirdPartyMojo extends AbstractLicenseMojo {
/**
* A URL prepared either our of {@link #overrideFile} or {@link #overrideUrl} or the default value.
*
* @see LicenseMojoUtils#prepareThirdPartyOverrideUrl(URL, File, String, File)
* @see LicenseMojoUtils#prepareThirdPartyOverrideUrl(String, File, String, File)
*/
protected String resolvedOverrideUrl;

Expand Down
Loading