Maven shade + resteasy可以找到内容类型的作家 [英] Maven shade + resteasy Could find writer for content-type

查看:115
本文介绍了Maven shade + resteasy可以找到内容类型的作家的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个适用于maven托管依赖项的项目。但是我要求将我的jar文件作为一个。

I have a project that works fine with maven managed dependencies. But I have a requirement for giving my jar files as one.

为此,我使用maven-shade插件( http://maven.apache.org/plugins/maven-shade-plugin/ )。所有类文件都正确导出但是当我尝试运行我的应用程序时出现错误:

For this I use maven-shade plugin (http://maven.apache.org/plugins/maven-shade-plugin/). All class files are exported correctly but when I try to run my application I get an error as:

可以找到内容类型multipart / form-data类型的writer:org .jboss.reasteasy.plugins.provider.multipart.MultipartFormDataOutput

Could find writer for content-type multipart/form-data type: org.jboss.reasteasy.plugins.provider.multipart.MultipartFormDataOutput

任何帮助都会很棒,谢谢。

Any help would be great, thanks.

注意:我遇到类似spring的问题,其主要原因是配置文件。许多jar文件包含具有相同名称的configuraiton文件。所有配置文件都尝试覆盖其他配置文件。合并该文件与maven-shade配置问题后,问题就解决了。

Note: I had a similar problem with spring whose main cause is configuration files. Many jar files contained a configuraiton file that has same name. All configuration files tries to override the others. After merging that file with maven-shade configuration problem was solved.

推荐答案

您可能错过了下面列出的一个Shade变换器。在我的Shade构建的jar文件上运行'java -jar'时,我看到了与你相同的错误。确保您有org.apache.maven.plugins.shade.resource.ServicesResourceTransformer条目。提供某些接口实现的JAR文件通常附带META-INF / services /目录,该接口将接口映射到其实现类以供服务定位器查找。要将同一接口的多个实现合并到一个服务条目中,可以使用ServicesResourceTransformer。我相信在Shade下运行RestEasy就是这种情况。

You maybe missing one of the Shade transformers listed below. I was seeing the same error as yours when running 'java -jar' on my Shade-built jar file. Make sure you have a org.apache.maven.plugins.shade.resource.ServicesResourceTransformer entry. JAR files providing implementations of some interfaces often ship with a META-INF/services/ directory that maps interfaces to their implementation classes for lookup by the service locator. To merge multiple implementations of the same interface into one service entry, the ServicesResourceTransformer can be used. I believe this was the case with RestEasy running under Shade.

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <transformers>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>path.to.your.App</mainClass>
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                <resource>META-INF/spring.handlers</resource>
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                <resource>META-INF/spring.schemas</resource>
                            </transformer>
                            <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                        </transformers>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

这篇关于Maven shade + resteasy可以找到内容类型的作家的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆