maven-heaven: `map_shaded_classes_to_maven_packages` ignores POMs present only in the from/ codebase, leaving all shaded .class resources unmapped

Ouverte
#2,284 0 commentaires 0 réactions 1 personne assignée Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@chinyeungli y travaille déjà.

Depuis le 28/10/2026.

Évaluation

Cette issue n'a pas encore été évaluée.

Description

This is a follow-up issue for #2247

When scanning a Maven package whose binary JAR excludes META-INF/maven/** (a common shade‑plugin configuration) but whose source JAR still contains the POM, the shaded .class resources in the binary are never mapped back to their originating Maven dependencies. They remain with an application-package status instead of shaded-class.

Sample

PURL: pkg:maven/org.apache.kyuubi/[email protected]

There is no pom.xml in the deployment (to/) codebase. The only POM present is: from/META-INF/maven/org.apache.kyuubi/kyuubi-relocated-thrift/pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <parent>
    <artifactId>kyuubi-relocated-parent</artifactId>
    <groupId>org.apache.kyuubi</groupId>
    <version>0.4.1</version>
    <relativePath>../../pom.xml</relativePath>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>kyuubi-relocated-thrift</artifactId>
  <description>Relocated Thrift classes used by Kyuubi internally.</description>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <id>shade-kyuubi</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <createDependencyReducedPom>true</createDependencyReducedPom>
              <dependencyReducedPomLocation>${project.basedir}/target/dependency-reduced-pom.xml</dependencyReducedPomLocation>
              <artifactSet>
                <includes>
                  <include>*</include>
                </includes>
              </artifactSet>
              <filters>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>**/*.proto</exclude>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                    <exclude>META-INF/DEPENDENCIES</exclude>
                    <exclude>META-INF/LICENSE.txt</exclude>
                    <exclude>META-INF/NOTICE.txt</exclude>
                    <exclude>META-INF/maven/**</exclude>
                    <exclude>LICENSE.txt</exclude>
                    <exclude>NOTICE.txt</exclude>
                    <exclude>mozilla/**</exclude>
                    <exclude>**/module-info.class</exclude>
                  </excludes>
                </filter>
              </filters>
              <relocations>
                <relocation>
                  <pattern>com.facebook.fb303</pattern>
                  <shadedPattern>${shading.prefix}.fb303</shadedPattern>
                  <includes>
                    <include>com.facebook.fb303.**</include>
                  </includes>
                </relocation>
                <relocation>
                  <pattern>org.apache.thrift</pattern>
                  <shadedPattern>${shading.prefix}.thrift</shadedPattern>
                  <includes>
                    <include>org.apache.thrift.**</include>
                  </includes>
                </relocation>
              </relocations>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>flatten-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>compile</id>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>${basedir}/target/${project.artifactId}-${project.version}.jar</file>
                  <type>jar</type>
                  <classifier>optional</classifier>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <properties>
    <thrift.version>0.16.0</thrift.version>
    <fb303.version>0.9.3</fb303.version>
  </properties>
</project>

Note that the binary archive excludes META-INF/maven/** and therefore no pom.xml in the deployment codebase.
As a result, the map_shaded_classes_to_maven_packages is not mapping anything.

Issues:

Langage dominant
Python
Étoiles
223
Forks
214
Merge moyen
2 j 3 h
PR mergées (30 j)
13

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de aboutcode-org/scancode.io

Toutes les issues de aboutcode-org/scancode.io

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.