[
https://issues.apache.org/jira/browse/RAT-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17805225#comment-17805225
]
Claude Warren edited comment on RAT-343 at 1/11/24 8:39 AM:
------------------------------------------------------------
There is an extensive change to how licenses are defined. It is now possible
to define them in a standard XML format. The Maven plugin uses a modified
version of that format because Maven POM XML does not support attributes on
elements. You can write a license file and tell the plugin to use it if you
wish.
So the short answer is to [~ggregory] is:
<configuration>
<licenses>
<license>
<family>MyCat</family>
<notes />
<any>
<text>${my.property1}</text>
<text>${my.property2}</text>
</any>
</license>
</licenses>
<families>
<family>
<id>MyCat</id>
<name>My Custom string</name>
</family>
<families>
</licenses>
...
Each license is associated with a family. Multiple licenses can be associated
with a family.
Each license may have a notes element.
Each license has one matcher.
Available matchers are:
* all - A collection of matchers in which all enclosed matchers have to be
true for the matcher to report true.
* any - A collection of matchers that will report true if any enclosed matcher
is true.
* copyright - A matcher that matches Copyright text. This uses regular
expressions and so should only be used when looking for copyrights with
specific patterns that are not caught by a standard text matcher. This matcher
will match "(C)", "copyright", or "©". (text is not case sensitive). It will
also match things like Copyright (c) joe 1995 as well as Copyright (C) 1995
joe. Copyright has 3 child elements:
** start - the starting date of the copyright or the only date.
** end - the ending date of the copyright. Only valid if the starting date is
provided.
** owner - the copyright owner.
* not - A matcher that wraps one matcher and negates its value. Not matchers
require that the entire header be read before it can report true or false.
This may significantly slow processing.
* regex - A matcher that matches a regex string.
* spdx - A matcher that matches SPDX tags. SPDX tags have the form:
SPDX-License-Identifier: short-name, where short-name matches the regex pattern
"[A-Za-z0-9\.\-]+". spdx takes the short name as an argument.
Other changes of note:
* If you define families and do not define approvedFamilies in your pom all
the families are assumed to be approved.
* There is a file that defines all of the standard licenses.
[apache-rat-core/src/main/resources/org/apache/rat/default.xml|https://github.com/apache/creadur-rat/blob/master/pom.xml]
It should be possible to write an XSLT to convert from the old format to the
new one, but I have not had time to try that.
I hope this helps.
was (Author: claudenw):
There is an extensive change to how licenses are defined. It is now possible
to define them in a standard XML format. The Maven plugin uses a modified
version of that format because Maven POM XML does not support attributes on
elements. You can write a license file and tell the plugin to use it if you
wish.
{{So the short answer is to [~ggregory] is:}}
{{ <configuration>}}
{{ <licenses>}}
{{ <license>}}
{{ <family>MyCat</family>}}
{{ <notes />}}
{{ <any>}}
{{ <text>${my.property1}</text>}}
{{ <text>${my.property2}</text>}}
{{ </any>}}
{{ </license>}}
{{ </licenses>}}
{{ <families>}}
{{ <family>}}
{{ <id>MyCat</id>}}
{{ <name>My Custom string</name>}}
{{ </family>}}
{{ <families>}}
{{ </licenses>}}
{{ ...}}
{{{}Each license is associated with a family. Multiple licenses can be
associated with a family.{}}}{{{}{}}}
{{Each license may have a notes element.}}
{{Each license has one matcher. }}
{{Available matchers are:}}
* {{all - A collection of matchers in which all enclosed matchers have to be
true for the matcher to report true.}}
* {{any - A collection of matchers that will report true if any enclosed
matcher is true.}}
* {{copyright - A matcher that matches Copyright text. This uses regular
expressions and so should only be used when looking for copyrights with
specific patterns that are not caught by a standard text matcher. This matcher
will match "(C)", "copyright", or "©". (text is not case sensitive). It will
also match things like Copyright (c) joe 1995 as well as Copyright (C) 1995
joe. Copyright has 3 child elements}}
** {{start - the starting date of the copyright or the only date.}}
** {{end - the ending date of the copyright. Only valid if the starting date
is provided.}}
** {{{}owner - the copyright owner.{}}}{{{}{}}}
* {{not - A matcher that wraps one matcher and negates its value. Not
matchers require that the entire header be read before it can report true or
false. This may significantly slow processing.}}
* {{regex - A matcher that matches a regex string.}}
* {{spdx - A matcher that matches SPDX tags. SPDX tags have the form:
SPDX-License-Identifier: short-name, where short-name matches the regex pattern
"[A-Za-z0-9\.\-]+". spdx takes the short name as an argument.}}
{{Other changes of note:}}
* {{If you define families and do not define approvedFamilies in your pom all
the families are assumed to be approved.}}
* {{{}There is a file that defines all of the standard licenses.
[apache-rat-core/src/main/resources/org/apache/rat/default.xml|https://github.com/apache/creadur-rat/blob/master/pom.xml]{}}}{{{}{}}}
{{It should be possible to write an XSLT to convert from the old format to the
new one, but I have not had time to try that.}}
I hope this helps.
> Custom licensenses not working in contrast to v0.15
> ---------------------------------------------------
>
> Key: RAT-343
> URL: https://issues.apache.org/jira/browse/RAT-343
> Project: Apache Rat
> Issue Type: Bug
> Components: license-meta-data, scan, site
> Affects Versions: 0.16
> Reporter: Philipp Ottlinger
> Priority: Major
>
> Due to the changes introduced in 0.16 projects with custom license
> definitions do not seem to work anymore as reported by [~solomax] with
> OpenMeetings:
> [https://github.com/apache/openmeetings/blob/master/pom.xml#L1393]
> Verify that the documentation provided in
> [https://creadur.apache.org/rat/apache-rat-plugin/examples/custom-license.html]
> is correct and ideally add an example usage to
> [CreadurExamples|https://github.com/ottlinger/creadur-rat-examples] to
> prevent future regressions.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)