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

Header is added instead of being replaced, if formats differ #242

Open
cns-solutions-admin opened this issue Nov 19, 2021 · 6 comments · May be fixed by #243
Open

Header is added instead of being replaced, if formats differ #242

cns-solutions-admin opened this issue Nov 19, 2021 · 6 comments · May be fixed by #243
Assignees
Labels
in:core MLP core module is:bug Bugs to fix todo Accepted items from the backlog which can be worked on

Comments

@cns-solutions-admin
Copy link

cns-solutions-admin commented Nov 19, 2021

If in multi line patterns the before pattern changes, the header is added instead of being replaced.

If the custom header style looks like this:

/************
**
************/

and the current header is

/**
 *
 */

then only the first line is replaced with the new header (because the second line does not start with "**").

cns-solutions-admin added a commit to CNS-Solutions/license-maven-plugin that referenced this issue Nov 19, 2021
cns-solutions-admin added a commit to CNS-Solutions/license-maven-plugin that referenced this issue Nov 19, 2021
cns-solutions-admin added a commit to CNS-Solutions/license-maven-plugin that referenced this issue Nov 19, 2021
@cns-solutions-admin cns-solutions-admin linked a pull request Nov 19, 2021 that will close this issue
@cns-solutions-admin
Copy link
Author

Fixed in PR #243 by introducing a new optional regex.

@mathieucarbou mathieucarbou added in:core MLP core module is:enhancement Enhancement to an existing feature todo Accepted items from the backlog which can be worked on labels Nov 26, 2021
@mathieucarbou mathieucarbou linked a pull request Nov 26, 2021 that will close this issue
@mathieucarbou mathieucarbou added this to the 4.3 milestone Nov 26, 2021
@mathieucarbou
Copy link
Owner

Ok I understand a bit more... Let me review...

@mathieucarbou mathieucarbou added is:bug Bugs to fix and removed is:enhancement Enhancement to an existing feature labels Nov 26, 2021
@AdrienHorgnies
Copy link

Hi,

I have the same problem even when the formatting is exactly the same.
In the code block below, you can see that the new header has been prepended right above the previous one :

/*
 * SWIFT (c) 2022. All rights reserved.
 *
 * This software and its associated documentation contain
 * proprietary, confidential and trade secret information of
 * S.W.I.F.T. SCRL, and except as provided in your contractual
 * arrangements with S.W.I.F.T. SCRL.
 * a) no part may be reproduced, made available,
 *    adapted or translated in any form or by any means, and
 * b) this software may only be installed and used by a duly
 *    registered SWIFT User, SWIFT Partner or Service Bureau
 *    in compliance with the terms of the licence with SWIFT.
 *    This software may only be used to access and use the
 *    SWIFT services and products.
 * For more information about what you may or may not do with
 * this software and any related documentation, including any
 * limitations on warranties and/or remedies, refer to your
 * relevant contractual arrangements with SWIFT.
 */
/*
 * SWIFT (c) 2021. All rights reserved.
 *
 * This software and its associated documentation contain
 * proprietary, confidential and trade secret information of
 * S.W.I.F.T. SCRL, and except as provided in your contractual
 * arrangements with S.W.I.F.T. SCRL.
 * a) no part may be reproduced, made available,
 *    adapted or translated in any form or by any means, and
 * b) this software may only be installed and used by a duly
 *    registered SWIFT User, SWIFT Partner or Service Bureau
 *    in compliance with the terms of the licence with SWIFT.
 *    This software may only be used to access and use the
 *    SWIFT services and products.
 * For more information about what you may or may not do with
 * this software and any related documentation, including any
 * limitations on warranties and/or remedies, refer to your
 * relevant contractual arrangements with SWIFT.
 */

And I have the below configuration :

<plugin>
    <groupId>com.mycila</groupId>
    <artifactId>license-maven-plugin</artifactId>
    <version>4.1</version>
    <configuration>
        <header>license-header.txt</header>
        <properties>
            <license.year>2022</license.year>
        </properties>
        <includes>
            <include>src/*/java/**/*.java</include>
        </includes>
    </configuration>
    <executions>
        <execution>
            <id>first</id>
            <goals>
                <goal>format</goal>
            </goals>
            <phase>process-resources</phase>
        </execution>
    </executions>
</plugin>

@hazendaz
Copy link
Collaborator

hazendaz commented Nov 3, 2022

Please use 4.2.rc3 instead as this issue I believe was fixed. I haven't seen it in a long time myself and used to regularly.

@mathieucarbou
Copy link
Owner

mathieucarbou commented Nov 3, 2022

@AdrienHorgnies : copyright section detection is done by using keywords like "copyright". I think this is configurable with the licenseSet.keyworkds config

@AdrienHorgnies
Copy link

@AdrienHorgnies : copyright section detection is done by using keywords like "copyright". I think this is configurable with the licenseSet.keyworkds config

Indeed, that's what it. Thanks; So my issue was only bad usage after all.

@hazendaz hazendaz modified the milestones: 4.4, 4.5 Jan 20, 2024
@mathieucarbou mathieucarbou removed this from the 4.5 milestone May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in:core MLP core module is:bug Bugs to fix todo Accepted items from the backlog which can be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants