2016-07-07 49 views
0

我使用marklogic java client-api來提取文檔,它在我的intellij中工作的很好,但是當我構建一個影子jar並運行它時,我得到以下例外marklogic java client-api異常通過影子jar通過gradle構建

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這個..和我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做建築的陰影罐子......我缺少的東西?

感謝,

回答

0

我能解決我的問題..這是導致錯誤的問題是META-INF各種罐/服務的融合。而在我build.gradle我用錯了轉換..我改變從上面的build.gradle以下和一切工作..

原來的部分

import com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer 

     shadowJar { 
      transform(AppendingTransformer) { 
       resource = 'META-INF/services' 
      } 

     } 

更改爲以下

shadowJar { 
    mergeServiceFiles() 
} 

我使用了錯誤的轉換..我需要合併我所有的服務文件..