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

Conversation

Master-Code-Programmer
Copy link
Contributor

For every Open Source Software (OSS) we use, our customer wants an extensive license report.
This plugin is almost perfect for that, except:

  • The aggregate-third-party goal writes (although formatable) just text-files
  • The aggregate-download-licenses write a nice xml, but with even less information - the project/plugin name is missing.
  • But the more important thing: Our customer needs, also with copyleft licensed OSS, the copyright notices for each software. Plus the plugin vendor and similar stuff. Many of these information aren't provided or updated in the plugins pom.xml's while their JARs MANIFEST.MF files are clean, informative and maintained. The JARs can contain:
    ** The MANIFEST.MF with Bundle vendor, implementer, bundle license
    ** Multiple license text files for each license, directly in the JAR, no need to download that. So I'm looking for a LICENSE.txt file and all text files having a SPDX license name.
    ** Also NOTICE.txt files which contain often all relevant copyright information.

So I forked an extension which tries to fetch as much information as it can get from the JAR file and writes that with some pom.xml information, which was previously ignored, to the license.xml file.

This is of course optional, obviously the previous solution was good enough for most people so it's "off" by default (parameter is "extendedInfo", goal is "license:aggregate-download-licenses").

Since the next task would be:
"And now write an excessive amount of XSLT declarations to create a CSV report to import that into Excel, were you would have to pay extra attention so Excel doesn't convert all version numbers to dates, fit all columns, freeze header columns and rows, group them, etc.".
I skipped that part and added an option to write the result into a properly formatted Excel / Calc file (parameter is "writeExcelFile" / "writeCalcFile", the Excel file is better formatted).

And I still need the XML, since I need to parse it periodically and persist it into a database.

Since I wrote this I got E-Mails from people thanking me for this work and how useful it is. I now would like to have this integrated into the original plugin.

I would very much appreciate an acceptance of this pull request.

Jan-Hendrik Diederich and others added 30 commits November 14, 2019 09:27
Extended information are fetched from JAR files contents.
The option is a boolean called "extendedInfo" and a parameter for the aggregate-download-licenses goal.
- Header font bold
- Header light green background
- Alternating white / light gray background
   --> To group all lines belonging to one plugin/dependency together.
Newline control characters are valid XML, form-feed control characters are invalid XML (destroying .xml and .ods files)
@Master-Code-Programmer Master-Code-Programmer changed the title Feature/pull request Write Excel files with extensive License Information (inc. infos from the JARs) Oct 29, 2023
@slawekjaranowski
Copy link
Member

Thanks for PR.
I will try to review in next week.

@Master-Code-Programmer
Copy link
Contributor Author

Example images of the exported Excel file:
TopLeft

The top header rows and left column are fixed, so they don't scroll when scrolling through the Excel spreadsheet:
TopMiddleExplained

Hide columns to increase clarity and focus on what really interests you right now:
TopMiddleHideColumns

@Master-Code-Programmer
Copy link
Contributor Author

Thanks for PR. I will try to review in next week.

Thanks :-)

Forgot: I kept the "run-one-it" profile to run single integration tests.

I kept it because I needed to run the same test over and over, and not having to run all other tests together with mine, helped increase the development speed immensely. Because all integration tests together, take forever.

@slawekjaranowski
Copy link
Member

run-one-it is not needed - you can use:

mvn verify -P run-its -Dinvoker.test=testName

@Master-Code-Programmer
Copy link
Contributor Author

Master-Code-Programmer commented Nov 2, 2023

run-one-it is not needed - you can use:

mvn verify -P run-its -Dinvoker.test=testName

Thanks, tested it, it works, I removed the single-test profile and pushed it to the Pull-Request, reducing its size 👍.

Copy link
Member

@slawekjaranowski slawekjaranowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for new feature @since tags should be update to 2.4.0

.gitattributes Outdated Show resolved Hide resolved
pom.xml Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also update LicenseSummaryReader?

By the way I don't see documentation about license summary content which is generated ... issue for next PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to answer that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have xsd for it ... it is manually updated ...
Please look #528

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, I checked the XSD with some IDEs and found many errors, already in the existing XSD. I fixed those old bugs and added my newly written entries to the XSD.

To make sure the bugs don't reappear, I added XML validations against the XSD, to the unit test.

I also added an option that the XSD file is written into the same directory as the XML file is written into, and then gets referenced in the XML file. It's set with <useXsd>true</useXsd>. So the XSD file can easily be used.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update current xsd file is enough - please remove useXsd options.

We should replace manual xml writing by Modello - we will have a automatic xsd with documentation generation.
It should be done in separate PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update current xsd file is enough - please remove useXsd options.

We should replace manual xml writing by Modello - we will have a automatic xsd with documentation generation. It should be done in separate PR.

I just want you to understand why I added the option. I never knew the XSD was somewhere inside the plugin, as most people I think. But with that option, it becomes very visible and easily usable by everyone.

On the other hand, will (after #529) the then generated XML reference the generated XSD? And how long do you estimate till #529 is implemented?

If you still want the useXsd option removed, I will remove it, without further questions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove useXsd.

As it is open source project, so I don't know when generated XML will be implemented.

I will try to do it in next month unless someone else will do it early.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slawekjaranowski:

Please remove useXsd.

Done.

I think all problems are resolved then?

@slawekjaranowski slawekjaranowski merged commit fe0747a into mojohaus:master Dec 10, 2023
7 checks passed
@slawekjaranowski
Copy link
Member

@Master-Code-Programmer thanks for you contribution.

@Master-Code-Programmer
Copy link
Contributor Author

@slawekjaranowski As an afterthought, this is not a must for me, but may I humbly ask that you put me in the contributors list in the pom.xml under

<contributors>
    <contributor>
      <name>Jan-Hendrik Diederich</name>
    </contributor>

? I'm OK if you consider my contribution to be too insignificant to be mentioned.

@slawekjaranowski
Copy link
Member

@Master-Code-Programmer Of course your contributions deserves to add you to contributors list.
Please create PR for it.

@Master-Code-Programmer Master-Code-Programmer deleted the feature/pullRequest branch December 10, 2023 15:54
Master-Code-Programmer pushed a commit to Master-Code-Programmer/license-maven-plugin that referenced this pull request Dec 10, 2023
@Master-Code-Programmer
Copy link
Contributor Author

@Master-Code-Programmer Of course your contributions deserves to add you to contributors list. Please create PR for it.

Thanks.
Done: It's #534.

Master-Code-Programmer pushed a commit to Master-Code-Programmer/license-maven-plugin that referenced this pull request Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Forked a version which can download much more detailed license information
2 participants