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

Header is added instead of being replaced, if formats differ

cns-solutions-admin opened this issue · 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 "**").

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

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

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>

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.

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

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