This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/maven-remote-resources-plugin.git

commit 579811955a0ed008ba30052e88a53004b2b6f8f8
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Wed Oct 28 10:15:46 2026 +0000

    Name the ASF-specific and per-ID helpers asfCategory and licenseIds
---
 .../project/src/main/resources/DEPENDENCIES.vm     |  4 ++--
 .../plugin/resources/remote/SpdxLicenses.java      | 14 ++++++-------
 .../plugin/resources/remote/license-categories.txt |  2 ++
 src/site/markdown/usage.md.vm                      |  4 ++--
 .../plugin/resources/remote/SpdxLicensesTest.java  | 24 +++++++++++-----------
 5 files changed, 25 insertions(+), 23 deletions(-)

diff --git 
a/src/it/resources/spdx-license-id/project/src/main/resources/DEPENDENCIES.vm 
b/src/it/resources/spdx-license-id/project/src/main/resources/DEPENDENCIES.vm
index 428baa9..2446bdc 100644
--- 
a/src/it/resources/spdx-license-id/project/src/main/resources/DEPENDENCIES.vm
+++ 
b/src/it/resources/spdx-license-id/project/src/main/resources/DEPENDENCIES.vm
@@ -18,7 +18,7 @@ Override: #if 
($projectName)$projectName#else${project.name}#end
 #foreach( $dependency in $projects )
 $dependency.artifactId expression: $!spdx.expression($dependency)
 #set( $preferred = $spdx.preferred($dependency) )
-$dependency.artifactId preferred:#if( $preferred ) $preferred 
$!spdx.category($preferred)#end
+$dependency.artifactId preferred:#if( $preferred ) $preferred 
$!spdx.asfCategory($preferred)#end
 #foreach( $license in $dependency.licenses )
 #set( $id = $spdx.id($license) )
 $dependency.artifactId: #if( $id )$id#else$license.name#end
@@ -27,7 +27,7 @@ $dependency.artifactId: #if( $id )$id#else$license.name#end
 #foreach( $entry in $spdx.group($projects).entrySet() )
 Group $entry.key:#foreach( $dependency in $entry.value ) 
$dependency.artifactId#end
 #end
-#foreach( $id in $spdx.ids($projects) )
+#foreach( $id in $spdx.licenseIds($projects) )
 License text: $id
 #end
 #foreach( $dependency in $spdx.unresolved($projects) )
diff --git 
a/src/main/java/org/apache/maven/plugin/resources/remote/SpdxLicenses.java 
b/src/main/java/org/apache/maven/plugin/resources/remote/SpdxLicenses.java
index ec6699e..52aa9b0 100644
--- a/src/main/java/org/apache/maven/plugin/resources/remote/SpdxLicenses.java
+++ b/src/main/java/org/apache/maven/plugin/resources/remote/SpdxLicenses.java
@@ -55,10 +55,10 @@ import org.apache.maven.project.MavenProject;
  * <p>
  * An ASF distribution names one chosen license for such a project: 
<code>$!spdx.preferred($project)</code>
  * picks it by <a href="https://www.apache.org/legal/resolved.html";>ASF 
license category</a>, which
- * <code>$!spdx.category($id)</code> returns.
+ * <code>$!spdx.asfCategory($id)</code> returns.
  * <p>
  * To list each license once, <code>$spdx.group($projects)</code> groups 
dependencies by preferred license,
- * <code>$spdx.ids($projects)</code> returns every ID they use, and 
<code>$spdx.unresolved($projects)</code>
+ * <code>$spdx.licenseIds($projects)</code> returns every ID they use, and 
<code>$spdx.unresolved($projects)</code>
  * returns the dependencies that match nothing.
  *
  * @since 3.4.0
@@ -210,7 +210,7 @@ public class SpdxLicenses {
                 continue;
             }
             for (String choice : alternatives(id)) {
-                int rank = rank(category(choice));
+                int rank = rank(asfCategory(choice));
                 if (rank < bestRank) {
                     best = choice;
                     bestRank = rank;
@@ -228,7 +228,7 @@ public class SpdxLicenses {
      * @param expression an SPDX ID or expression, for example from 
<code>$spdx.preferred($dependency)</code>
      * @return the category, or {@code null} when it is not known
      */
-    public String category(String expression) {
+    public String asfCategory(String expression) {
         if (isBlank(expression)) {
             return null;
         }
@@ -241,7 +241,7 @@ public class SpdxLicenses {
         if (alternatives.size() > 1) {
             String best = null;
             for (String alternative : alternatives) {
-                String c = category(alternative);
+                String c = asfCategory(alternative);
                 best = rank(c) < rank(best) ? c : best;
             }
             return best;
@@ -250,7 +250,7 @@ public class SpdxLicenses {
         if (parts.size() > 1) {
             String worst = "A";
             for (String part : parts) {
-                String c = category(part);
+                String c = asfCategory(part);
                 worst = rank(c) > rank(worst) ? c : worst;
             }
             return worst;
@@ -351,7 +351,7 @@ public class SpdxLicenses {
      * @param projects projects, typically <code>$projects</code>
      * @return the IDs, sorted
      */
-    public Set<String> ids(List<MavenProject> projects) {
+    public Set<String> licenseIds(List<MavenProject> projects) {
         Set<String> result = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
         for (String expression : group(projects).keySet()) {
             Matcher m = EXPRESSION_TOKEN.matcher(expression);
diff --git 
a/src/main/resources/org/apache/maven/plugin/resources/remote/license-categories.txt
 
b/src/main/resources/org/apache/maven/plugin/resources/remote/license-categories.txt
index 2d05426..6b0d925 100644
--- 
a/src/main/resources/org/apache/maven/plugin/resources/remote/license-categories.txt
+++ 
b/src/main/resources/org/apache/maven/plugin/resources/remote/license-categories.txt
@@ -43,6 +43,8 @@ EPL-2.0       B
 MPL-1.0        B
 MPL-1.1        B
 MPL-2.0        B
+# Category B only under the conditions in the "GPL-2.0 with GNU 
ClasspathException"
+# section of resolved.html; without the exception GPL-2.0-only is Category X.
 GPL-2.0-only WITH Classpath-exception-2.0      B
 
 AGPL-3.0-only  X
diff --git a/src/site/markdown/usage.md.vm b/src/site/markdown/usage.md.vm
index 6b082fe..9050cc2 100644
--- a/src/site/markdown/usage.md.vm
+++ b/src/site/markdown/usage.md.vm
@@ -131,9 +131,9 @@ A mapping matches a spelling wherever it appears, like 
`licenseMerges` in the [L
 
 A dependency that declares several licenses may be used under any one of them. 
`${esc.d}spdx.expression(${esc.d}dependency)` returns one SPDX license 
expression for the whole dependency, joining the IDs with `OR`, for example 
`CDDL-1.1 OR (GPL-2.0-only WITH Classpath-exception-2.0)`. It returns null when 
the dependency declares no license or when one of its licenses matches nothing, 
because a partial expression would leave out a choice.
 
-An ASF distribution states the one license it uses a dependency under: 
"include only the license that you have chosen. Prefer Category A to Category B 
to Category X" ([ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html)). 
`${esc.d}spdx.preferred(${esc.d}dependency)` makes that choice. Of the licenses 
that resolve, it returns the first one in Category A, else in Category B, else 
one without a known category, else in Category X; licenses that resolve to 
nothing are sk [...]
+An ASF distribution states the one license it uses a dependency under: 
"include only the license that you have chosen. Prefer Category A to Category B 
to Category X" ([ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html)). 
`${esc.d}spdx.preferred(${esc.d}dependency)` makes that choice. Of the licenses 
that resolve, it returns the first one in Category A, else in Category B, else 
one without a known category, else in Category X; licenses that resolve to 
nothing are sk [...]
 
-To list each license once rather than once per dependency, 
`${esc.d}spdx.group(${esc.d}projects)` groups the dependencies by preferred 
license. `${esc.d}spdx.ids(${esc.d}projects)` returns every license and 
exception ID in use, each one once, so a template can add each license text 
once. `${esc.d}spdx.unresolved(${esc.d}projects)` returns the dependencies 
without a preferred license, which still need their declared licenses listed:
+To list each license once rather than once per dependency, 
`${esc.d}spdx.group(${esc.d}projects)` groups the dependencies by preferred 
license. `${esc.d}spdx.licenseIds(${esc.d}projects)` returns every license and 
exception ID in use, each one once, so a template can add each license text 
once. `${esc.d}spdx.unresolved(${esc.d}projects)` returns the dependencies 
without a preferred license, which still need their declared licenses listed:
 
 ```
 #[[#foreach( $group in $spdx.group($projects).entrySet() )
diff --git 
a/src/test/java/org/apache/maven/plugin/resources/remote/SpdxLicensesTest.java 
b/src/test/java/org/apache/maven/plugin/resources/remote/SpdxLicensesTest.java
index 39ef612..65cda04 100644
--- 
a/src/test/java/org/apache/maven/plugin/resources/remote/SpdxLicensesTest.java
+++ 
b/src/test/java/org/apache/maven/plugin/resources/remote/SpdxLicensesTest.java
@@ -145,7 +145,7 @@ class SpdxLicensesTest {
         assertEquals(Arrays.asList(c), groups.get("CDDL-1.1"));
         assertEquals(
                 Arrays.asList("Apache-2.0", "CDDL-1.1"),
-                Arrays.asList(spdx.ids(projects).toArray()));
+                Arrays.asList(spdx.licenseIds(projects).toArray()));
         assertEquals(Arrays.asList(d), spdx.unresolved(projects));
     }
 
@@ -183,17 +183,17 @@ class SpdxLicensesTest {
     }
 
     @Test
-    void category() {
-        assertEquals("A", spdx.category("Apache-2.0"));
-        assertEquals("B", spdx.category("EPL-2.0"));
-        assertEquals("X", spdx.category("LGPL-2.1-or-later"));
-        assertEquals("B", spdx.category("GPL-2.0-only WITH 
Classpath-exception-2.0"));
-        assertEquals("X", spdx.category("GPL-3.0-only WITH 
Classpath-exception-2.0"));
-        assertEquals("A", spdx.category("(MIT OR GPL-2.0-only)"));
-        assertEquals("B", spdx.category("MIT AND EPL-2.0"));
-        assertNull(spdx.category("MIT AND Zlib"));
-        assertNull(spdx.category("Zlib"));
-        assertNull(spdx.category(null));
+    void asfCategory() {
+        assertEquals("A", spdx.asfCategory("Apache-2.0"));
+        assertEquals("B", spdx.asfCategory("EPL-2.0"));
+        assertEquals("X", spdx.asfCategory("LGPL-2.1-or-later"));
+        assertEquals("B", spdx.asfCategory("GPL-2.0-only WITH 
Classpath-exception-2.0"));
+        assertEquals("X", spdx.asfCategory("GPL-3.0-only WITH 
Classpath-exception-2.0"));
+        assertEquals("A", spdx.asfCategory("(MIT OR GPL-2.0-only)"));
+        assertEquals("B", spdx.asfCategory("MIT AND EPL-2.0"));
+        assertNull(spdx.asfCategory("MIT AND Zlib"));
+        assertNull(spdx.asfCategory("Zlib"));
+        assertNull(spdx.asfCategory(null));
     }
 
     private static License license(String name, String url) {

Reply via email to