Jersey Issues with Maven - Shade Plugin

My problem is very similar to: Jersey exception only thrown when envelopes are put together in one jar

I run my application (jetty embedded + jersey) and everything works. When I try to create an executable JAR, I get an error:

org.glassfish.jersey.message.internal.WriterInterceptorExecutor $ TerminalWriterInterceptor aroundWriteTo GRAVE: MessageBodyWriter not found for media type = application / json, type = class

My POM.XML:

<plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>server.application.DeepDig</mainClass>
                                </transformer>
                            </transformers>

                            <filters>
                                <!-- filter to address "Invalid signature file" issue - see https://stackoverflow.com/a/6743609/589215 -->
                                <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>
        </plugins>
+4
source share
1 answer

. , . :

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <configuration>
                <transformers>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                        <mainClass>Foo</mainClass>
                    </transformer>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                </transformers>
            </configuration>
        </plugin>

, , , "services" META-INF, . - . , .

, . , . , , .

+6

All Articles