Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-6195

maven-bundle-plugin adds module-info.java into OPT-INF/src twice

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • maven-bundle-plugin-4.2.1
    • None
    • Maven Bundle Plugin
    • None

    Description

      When adding sources to the generated bundle and having module-info.java present, this file appears in the artifact's OPT-INF/src twice.

      Technically, it seems that some entries are duplicated in a peculiar way. Running jar --list on the artifact produced from the sources listed below shows:

      META-INF/
      META-INF/MANIFEST.MF
      META-INF/maven/
      META-INF/maven/com.example/
      META-INF/maven/com.example/com.example/
      META-INF/maven/com.example/com.example/pom.properties
      META-INF/maven/com.example/com.example/pom.xml
      OSGI-OPT/
      OSGI-OPT/src/
      OSGI-OPT/src//
      OSGI-OPT/src//module-info.java
      OSGI-OPT/src/com/
      OSGI-OPT/src/com/example/
      OSGI-OPT/src/com/example/Main.java
      OSGI-OPT/src/module-info.java
      com/
      com/example/
      com/example/Main.class
      module-info.class

      Here is the small Hello World example that can be used to reproduce the behavior:

      <?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/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.example</groupId>
        <artifactId>com.example</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <packaging>bundle</packaging>
        <build>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>3.8.1</version>
              <configuration>
                <release>11</release>
                <source>11</source>
                <target>11</target>
              </configuration>
            </plugin>
            <plugin>
              <groupId>org.apache.felix</groupId>
              <artifactId>maven-bundle-plugin</artifactId>
              <version>4.2.1</version>
              <extensions>true</extensions>
              <configuration>
                <instructions>
                  <_sources>true</_sources>
                </instructions>
              </configuration>
            </plugin>
          </plugins>
        </build>
      </project>
      
      // src/main/java/module-info.java
      module com.example {
       exports com.example;
      }
      
      // src/main/java/com/example/Main.java
      package com.example;
      public final class Main {
          public static void main(String... args) {
              System.out.println("Hello World");
          }
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            pdolezal Petr Dolezal
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: