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

Remove / modify custom license not possible

sonicsdoom opened this issue · comments

Version affected

4.1. and 4.2.rc3

Describe the bug

I have added a custom license text header, unfortunately I cannot remove it using the "remove" function.

If I change the license text and call the function "format" again, the old header is not overwritten but extended by the new license text.

If I use a standard license, the functions "remove" and "format" work normally.

How to Reproduce

License-file: LICENSE

My Licenseinfo

Downloadlink: com.foo.bar

My maven-pom:

<plugin>
    <groupId>com.mycila</groupId>
    <artifactId>license-maven-plugin</artifactId>
    <version>4.2.rc3</version>
    <configuration>
        <header>LICENSE</header>
        <includes>
            <include>src/main/**</include>
        </includes>       
    </configuration>
    <dependencies>
        <dependency>
            <groupId>com.foo.bar</groupId>
            <artifactId>my-license</artifactId>
            <version>1.0</version>
        </dependency>
    </dependencies>
    <executions>
        <execution>
            <phase>compile</phase>
            <goals>
                <goal>check</goal>
            </goals>
        </execution>
    </executions>
</plugin>

1st step:
mvn license:format

result in java-class:

/*
 * My Licenseinfo
 *
 * Downloadlink: com.foo.bar
 */
package com.foo.bar;

import ...

2nd step:
mvn license:remove

expected behaviour:
License will be removed

actual behaviour:
License is still present in header

console log:

[INFO] --- license-maven-plugin:4.2.rc3:remove (default-cli) @ example-core ---
[INFO] Removing license headers...
[INFO] Removing license header from: C:\example\core\src\main\java\com\foo\bar\bar.java
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.

Yes, it is still relevant :)

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.

@mathieucarbou that feature was previously working and it should hopefully be a simple regression. Do you think you can tackle this one???

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.

yes it is

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.

Patiently waiting

@sonicsdoom @phax @CatPlanet : this works as expected. License removal is not linked to the configured license: it is based on header patterns and keywords. There is a keyword parameter you can use so that MLP can detect a header to remove. The default keyword is copyright.

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.

I think the main problem on my side was, that I was using the legacy configuration. After changing to the new configuration layout it seems to work. So my assumption is, that the backporting of the configuration params jn this matter is not 100% clean. But I stopped digging into it.

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.