license-maven-plugin icon indicating copy to clipboard operation
license-maven-plugin copied to clipboard

Header is added instead of being replaced, if formats differ

Open cns-solutions-admin opened this issue 2 years ago • 6 comments

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 avatar Nov 19 '21 13:11 cns-solutions-admin

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

cns-solutions-admin avatar Nov 19 '21 14:11 cns-solutions-admin

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

mathieucarbou avatar Nov 26 '21 13:11 mathieucarbou

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>

AdrienHorgnies avatar Nov 03 '22 14:11 AdrienHorgnies

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.

hazendaz avatar Nov 03 '22 14:11 hazendaz

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

mathieucarbou avatar Nov 03 '22 14:11 mathieucarbou

@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.

AdrienHorgnies avatar Nov 06 '22 17:11 AdrienHorgnies