2

I am trying to create a FAT jar and combine entries in META-INF/services/io.vertx.config.spi.ConfigProcessor from vertx-config and vert-config-yaml JAR files. I do not see a need for mainfest entry options for ServicesResourceTransformer, but I am experiencing the error:

Unable to parse configuration of mojo org.apache.maven.plugins:maven-shade-plugin:3.2.1:shade for parameter manifestEntries: Cannot find 'manifestEntries' in class org.apache.maven.plugins.shade.resource.ServicesResourceTransformer -> [Help 1]

At first, I did not add the line

<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />

and the manifest entries did not get merged and one of the class from vert-config-yaml is missing. Now I add the line as below, and I see the error. I am using maven-shade-plugin plugin version 3.2.1. What am I doing wrong here?

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>${maven.shade.version}</version>
          <executions>
            <execution>
              <phase>package</phase>
              <goals>
                <goal>shade</goal>
              </goals>
              <configuration>
              <filters>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>META-INF/.SF</exclude>
                    <exclude>META-INF/.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                  </excludes>
                </filter>
              </filters>
                <transformers>

                  <transformer
                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                    <manifestEntries>
                      <Main-Class>io.vertx.core.Launcher</Main-Class>
                      <Main-Verticle>${main.verticle}</Main-Verticle>
                    </manifestEntries>
                  </transformer>

                  <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />

                  <transformer
                    implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                    <resource>META-INF/services/io.vertx.core.spi.VerticleFactory</resource>
                  </transformer>
                </transformers>
                <artifactSet>
                </artifactSet>
                <outputFile>${project.build.directory}/${project.artifactId}-${project.version}-fat.jar</outputFile>
              </configuration>
            </execution>
          </executions>
        </plugin>

1 Answers1

3

Try adding <id> to your execution:

<execution>
  <id>shade-my-jar</id>
  <phase>package</phase>
    <goals>
      <goal>shade</goal>
    </goals>
</execution>

explanation (kinda symmetric question): https://stackoverflow.com/a/56154292

ska
  • 77
  • 1
  • 5