我嘗試在NetBeans中構建maven-project。在項目中,我使用jersey-media-json-jackson。我的依賴關係看起來像jersey-media-json-jackson不包含在jar中
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.23.1</version>
</dependency>
如果我在IDE中運行項目所有工作正常。但是,如果我建的項目有依賴關係和運行產生的JAR文件我有以下錯誤
org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor aroundWriteTo
SEVERE: MessageBodyWriter not found for media type=application/json, type=class com.ats.orion.client.model.req.UpdateContextRequest, genericType=class com.ats.orion.client.model.req.UpdateContextRequest.
Exception in thread "main" org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyWriter not found for media type=application/json, type=class com.ats.orion.client.model.req.UpdateContextRequest, genericType=class com.ats.orion.client.model.req.UpdateContextRequest.
同樣的例外出現在IDE時,我的評論球衣,媒體JSON - 傑克遜的依賴。在pom.xml中
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.ats.test.App</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
如何解決我的問題
我的構建塊?
我希望你在運行'罐子與 - dependencies'而不是缺省罐子生成。 –