mathieucarbou / license-maven-plugin

Manage license headers in your source files

Home Page:https://oss.carbou.me/license-maven-plugin/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mandatory email in APACHE-2 template

scordio opened this issue · comments

Version affected

4.1

Describe the bug

I'm not sure this is a bug or it's by design so please accept my apologies if it's not the case.

Currently, the APACHE-2 built-in template requires a mandatory email value for the copyright line, producing an output like:

Copyright 2023 Owner Name (email@domain.com)

Licensed under the Apache License, Version 2.0 (the "License");
...

However, the header suggested by the APACHE-2 license page only mentions:

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
...

without any explicit requirement for an email address in the copyright line.

If I don't specify the email property, I get a result like the following:

Copyright 2023 Owner Name (${email})

Licensed under the Apache License, Version 2.0 (the "License");
...

while I would like to get:

Copyright 2023 Owner Name

Licensed under the Apache License, Version 2.0 (the "License");
...

Aside from defining a custom header, I don't see any way to reach the result I'd like to have.

Would you consider some changes to achieve my last example with the built-in template? If yes, I can try to raise a PR.

How to Reproduce

Define:

        <configuration>
          <licenseSets>
            <licenseSet>
              <header>com/mycila/maven/plugin/license/templates/APACHE-2.txt</header>
              <includes>
                <include>src/**/*.java</include>
              </includes>
            </licenseSet>
          </licenseSets>
          <properties>
            <year>2023</year>
            <owner>Owner Name</owner>
          </properties>
        </configuration>

and execute license:format.

Hi @hazendaz, I started to look into this topic.

My idea would be to manipulate the string output after the properties are applied to the template, removing (${email}) if there was no email property.

As far as I can see, there are no tests for the built-in templates and maybe I could start by adding them. I imagine the tests should belong to one of the classes in com.mycila.maven.plugin.license.header but I couldn't figure out the right candidate.

I'll take a deeper look over the next few days but I'm happy to follow your suggestions if you have any.

commented

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Keep this open.

Thanks @hazendaz and thanks stale-bot for the reminder 😅

I'll try to come back to this topic in the coming weeks.

commented

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Yes, still relevant! 🙂

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Stale bot should have a way of marking something to not be reminded about again :)

Yes, still relevant! (Too late?)

@scordio : you will be able to point to com/mycila/maven/plugin/license/templates/APACHE-2-noemail.txt in next version.

Thanks a lot for taking care of it!