Open cvgaviao opened 5 years ago
not an issue: plugin is copying teh exact same number of space character from the inlineHeader
section.
We do not dynamically compute the number of space characters to add. This is given by the user config.
I think this is an issue actually, I don't think the OP meant the problem was with the number of spaces. Why does the plugin generate duplicate licenses? It does this even when using <skipExistingHeaders>true</skipExistingHeaders>
. It seems like the issue is with detecting whether the license already exists when using <inlineHeader>
@oscarbrookssynacor Can you make a small reproducible build for the issue?
Hi, thanks for the quick reply, I will work on one, but in the meantime, maybe this will suffice. Simply adding the following to the pom
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<!-- https://mvnrepository.com/artifact/com.mycila/license-maven-plugin -->
<version>4.3</version>
<configuration>
<properties>
<license.owner>Sample Owner</license.owner>
<license.years>2024</license.years>
<beginBlock>***** BEGIN LICENSE BLOCK *****${line.separator}</beginBlock>
<product>Sample Product.${line.separator}</product>
<copyright>Copyright (C) ${license.years} ${license.owner} </copyright>
<rights>All Rights Reserved.${line.separator}</rights>
<endBlock>***** END LICENSE BLOCK *****</endBlock>
</properties>
<skipExistingHeaders>true</skipExistingHeaders>
<licenseSets>
<licenseSet>
<inlineHeader>
<![CDATA[${beginBlock} ${product} ${copyright} ${rights} ${endBlock}]]>
</inlineHeader>
<includes>
<include>src/*/java/**/*.java</include>
</includes>
</licenseSet>
</licenseSets>
</configuration>
<executions>
<execution>
<id>first</id>
<goals>
<goal>format</goal>
</goals>
<phase>generate-sources</phase>
</execution>
</executions>
</plugin>
, running mvn install
and then changing anything about the license, such as the year for example <license.years>2025</license.years>
will result in a duplicate license.
Running the same thing with a .txt file based license does not.
or to simplify further,
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>4.3</version>
<configuration>
<properties>
<license.owner>Sample Owner</license.owner>
<license.years>2024</license.years>
</properties>
<skipExistingHeaders>true</skipExistingHeaders>
<licenseSets>
<licenseSet>
<inlineHeader>testInlineLicense</inlineHeader>
<includes>
<include>src/*/java/**/*.java</include>
</includes>
</licenseSet>
</licenseSets>
</configuration>
<executions>
<execution>
<id>first</id>
<goals>
<goal>format</goal>
</goals>
<phase>generate-sources</phase>
</execution>
</executions>
</plugin>
mvn install
followed by updating the string to <inlineHeader>testInlineLicense**2**</inlineHeader>
or any different string and reruningmvn install
I've set the license-maven-plugin in a profile in order to work with a custom header:
I also set the mapping for pom.xml:
But when I try to use it I'm ending with a duplicating header. In the example below I just changed the owner: