79659489

Date: 2025-06-09 20:24:55
Score: 1
Natty:
Report link

The answers are close. The jar file is failing because the Vendor field (or fields) are not in the Manifest.

These two values should be filled in in the MANIFEST.MF.

Specification-Vendor: Sun Microsystems, Inc.
Implementation-Vendor: Sun Microsystems, Inc.

Any values can be entered.

You can add these via the maven-assembly-plug in,

<configuration>
    <archive>
        <manifest>
            <mainClass>PROJECT.MAIN</mainClass>
            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
        </manifest>
        <manifestEntries>
            <Implementation-Vendor>Your name</Implementation-Vendor>
            <Specification-Vendor>Your name</Specification-Vendor>
        </manifestEntries>
    </archive>
    <descriptorRefs>
        <descriptorRef>jar-with-dependencies</descriptorRef>
    </descriptorRefs>
</configuration>

This works fine in some cases, but if you use Shade, it will not add these Manifest entries . However, you can hard code the MANIFEST.MF - I found the answer elsewhere on StackOverflow How can I specify a custom MANIFEST.MF file while using the Maven Shade plugin? I think this is better than editing the build.xml

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.4.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                                <!-- Add a transformer to exclude any other manifest files (possibly from dependencies). -->
                                <transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
                                    <resource>MANIFEST.MF</resource>
                                </transformer>

                                <!-- Add a transformer to include your custom manifest file. -->
                                <transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
                                    <resource>META-INF/MANIFEST.MF</resource>
                                    <file>src/main/resources/META-INF/MANIFEST.MF</file>
                                </transformer>

                            </transformers>

                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                    </excludes>
                                </filter>
                            </filters>

                        </configuration>
                    </execution>
                </executions>
            </plugin>
Reasons:
  • Blacklisted phrase (0.5): How can I
  • Blacklisted phrase (1): StackOverflow
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Ted Carroll