Marklogic java client-api exception via shadow jar build via gradle
Marklogic java client-api exception via shadow jar build via gradle
我正在使用 marklogic java client-api 来提取文档,在我的 intellij 中它工作正常,但是当我构建一个 shadow jar 并 运行 我得到以下异常
com.sun.jersey.api.client.RequestWriter$RequestEntityWriterImpl <init>
SEVERE: A message body writer for Java class com.marklogic.client.impl.StreamingOutputImpl, and Java type class com.marklogic.client.impl.StreamingOutputImpl, and MIME media type application/xml was not found
Jul 07, 2016 5:29:53 PM com.sun.jersey.api.client.RequestWriter$RequestEntityWriterImpl <init>
SEVERE: The registered message body writers compatible with the MIME media type are:
我正在使用 gradle 构建 shadow jar.. 我的 build.gradle
如下所示
buildscript {
repositories { jcenter() }
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
}
}
apply plugin: 'java'
apply plugin: 'wrapper'
apply plugin: 'com.github.johnrengelman.shadow'
sourceCompatibility = 1.7
targetCompatibility = 1.7
repositories {
mavenLocal()
maven {
url "http://nexus.abbvienet.com/content/groups/public"
}
}
import com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer
shadowJar {
transform(AppendingTransformer) {
resource = 'META-INF/services'
}
}
dependencies {
compile 'org.slf4j:slf4j-api:1.7.12'
compile 'ch.qos.logback:logback-classic:1.1.3'
compile 'com.moonlight:lfsappenders:4.0.3'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
compile group: 'commons-io', name: 'commons-io', version: '2.4'
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.0'
compile group: 'com.google.code.gson', name: 'gson', version: '2.3'
compile group: 'com.marklogic', name: 'java-client-api', version: '3.0.1'
compile group: 'dom4j', name: 'dom4j', version: '1.6.1'
compile group: 'org.jdom', name: 'jdom2', version: '2.0.5'
compile group: 'xom', name: 'xom', version: '1.2.5'
compile group: 'jaxen', name: 'jaxen', version: '1.1.6'
compile group: 'net.sourceforge.htmlcleaner', name: 'htmlcleaner', version: '2.4'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.4.1'
compile group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.4.1'
compile group: 'joda-time', name: 'joda-time', version: '2.9.4'
}
我认为这与我的 tramsform 有关...我错过了什么吗?
谢谢,
我能够解决我的问题。导致错误的问题是来自各种罐子的 META-INF/services 的合并。在我的 build.gradle
中,我使用了错误的转换。 . 我从上面 build.gradle 更改了以下内容,一切正常..
原节
import com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer
shadowJar {
transform(AppendingTransformer) {
resource = 'META-INF/services'
}
}
改成如下
shadowJar {
mergeServiceFiles()
}
我使用了错误的转换..我需要合并我所有的服务文件..
我正在使用 marklogic java client-api 来提取文档,在我的 intellij 中它工作正常,但是当我构建一个 shadow jar 并 运行 我得到以下异常
com.sun.jersey.api.client.RequestWriter$RequestEntityWriterImpl <init>
SEVERE: A message body writer for Java class com.marklogic.client.impl.StreamingOutputImpl, and Java type class com.marklogic.client.impl.StreamingOutputImpl, and MIME media type application/xml was not found
Jul 07, 2016 5:29:53 PM com.sun.jersey.api.client.RequestWriter$RequestEntityWriterImpl <init>
SEVERE: The registered message body writers compatible with the MIME media type are:
我正在使用 gradle 构建 shadow jar.. 我的 build.gradle
如下所示
buildscript {
repositories { jcenter() }
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
}
}
apply plugin: 'java'
apply plugin: 'wrapper'
apply plugin: 'com.github.johnrengelman.shadow'
sourceCompatibility = 1.7
targetCompatibility = 1.7
repositories {
mavenLocal()
maven {
url "http://nexus.abbvienet.com/content/groups/public"
}
}
import com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer
shadowJar {
transform(AppendingTransformer) {
resource = 'META-INF/services'
}
}
dependencies {
compile 'org.slf4j:slf4j-api:1.7.12'
compile 'ch.qos.logback:logback-classic:1.1.3'
compile 'com.moonlight:lfsappenders:4.0.3'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
compile group: 'commons-io', name: 'commons-io', version: '2.4'
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.0'
compile group: 'com.google.code.gson', name: 'gson', version: '2.3'
compile group: 'com.marklogic', name: 'java-client-api', version: '3.0.1'
compile group: 'dom4j', name: 'dom4j', version: '1.6.1'
compile group: 'org.jdom', name: 'jdom2', version: '2.0.5'
compile group: 'xom', name: 'xom', version: '1.2.5'
compile group: 'jaxen', name: 'jaxen', version: '1.1.6'
compile group: 'net.sourceforge.htmlcleaner', name: 'htmlcleaner', version: '2.4'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.4.1'
compile group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.4.1'
compile group: 'joda-time', name: 'joda-time', version: '2.9.4'
}
我认为这与我的 tramsform 有关...我错过了什么吗?
谢谢,
我能够解决我的问题。导致错误的问题是来自各种罐子的 META-INF/services 的合并。在我的 build.gradle
中,我使用了错误的转换。 . 我从上面 build.gradle 更改了以下内容,一切正常..
原节
import com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer
shadowJar {
transform(AppendingTransformer) {
resource = 'META-INF/services'
}
}
改成如下
shadowJar {
mergeServiceFiles()
}
我使用了错误的转换..我需要合并我所有的服务文件..