2015-11-26 88 views
0

我試圖編譯gradle,我得到這個錯誤,任何人都知道如何解決?
注意只有在執行構建應用程序時,應用程序才能正常運行在此錯誤的eclipse上。@XmlElement(「name」)^ symbol:class XmlElement gradle error?

E:\VirtualBox\projeto\nextinfo\web>gradle build 
:utils:compileJava UP-TO-DATE 
:utils:processResources UP-TO-DATE 
:utils:classes UP-TO-DATE 
:utils:jar UP-TO-DATE 
:web:compileJava 
    E:\VirtualBox\projeto\nextinfo\web\src\main\java\br\com\nextinfo\multimedia\web\model\DisplayDigital.java:8: error: package com.sun.xml.internal.txw2.annotation does not exist 
import com.sun.xml.internal.txw2.annotation.XmlElement; 

我的gradle文件。

apply plugin: 'java' 
apply plugin: 'war' 
apply plugin: 'eclipse-wtp' 
apply plugin: 'eclipse' 
apply plugin: 'jetty' 

sourceCompatibility = 1.8 
targetCompatibility = 1.8 

ext.springVersion= '4.1.7.RELEASE' 
ext.jacksondataTypeHibernate4 ='2.5.3' 
ext.easycriteriaVersion ='3.0.0' 
ext.hibernateCoreVersion ='4.3.10.Final' 
ext.hibernateValidadeVersion ='5.1.3.Final' 
ext.springDataVersion ='1.8.0.RELEASE' 
ext.mysqlConnectionVersion= '5.1.6' 
ext.servletApiVersion ='2.5' 

dependencies { 
    testCompile 'junit:junit:4.8.2' 
    compile project(':utils') 
    compile"javax.servlet:jstl:1.2" 
    compile "org.thymeleaf:thymeleaf-spring4:2.1.2.RELEASE" 
    compile group: 'javax.servlet', name: 'servlet-api', version: servletApiVersion 
    compile group: 'nz.net.ultraq.thymeleaf', name: 'thymeleaf-layout-  dialect', version: '1.2.9' 
    compile 'com.github.dandelion:datatables-thymeleaf:0.9.3' 
    compile 'com.github.dandelion:datatables-core:0.8.4' 
    compile 'org.jadira.usertype:usertype.core:4.0.0.GA' 
    compile 'net.sourceforge.html5valdialect:html5valdialect:2.1.2' 
    compile group: 'org.springframework.security', name: 'spring-security-web', version: '4.0.2.RELEASE' 
    compile group: 'org.springframework.security', name: 'spring-security-core', version: '4.0.2.RELEASE' 
    compile group: 'org.springframework.security', name: 'spring-security-config', version: '4.0.2.RELEASE' 
    compile 'org.thymeleaf.extras:thymeleaf-extras-springsecurity4:2.1.2.RELEASE' 
    compile group: 'org.springframework', name: 'spring-web', version: springVersion 
    compile group: 'org.springframework', name: 'spring-test', version: springVersion 
    compile group: 'org.springframework', name: 'spring-webmvc', version: springVersion 
    compile group: 'org.springframework.data', name: 'spring-data-jpa', version:springDataVersion 
    compile "org.postgresql:postgresql:9.3-1100-jdbc4" 
    compile group: 'uaihebert.com', name: 'EasyCriteria', version: easycriteriaVersion 
    compile group: 'org.hibernate', name: 'hibernate-validator', version: hibernateValidadeVersion 
    compile group: 'org.hibernate', name: 'hibernate-core', version: hibernateCoreVersion 
    compile group: 'org.hibernate', name: 'hibernate-entitymanager', version: hibernateCoreVersion 
    compile 'commons-fileupload:commons-fileupload:1.3.1' 
    compile 'com.fasterxml.jackson.datatype:jackson-datatype-hibernate4:2.6.2' 

    } 

回答

0

您需要告訴gradle如何解決所有依賴關係。你可以使用任何你喜歡的回購。您可以通過提供庫,關閉這樣做:

..... 
ext.servletApiVersion ='2.5' 

repositories { 
    mavenLocal() 
    mavenCentral() 
} 

dependencies { 
.... 

因此,這將嘗試使用一個Maven回購來解決依賴性。這裏有更多的信息: https://docs.gradle.org/current/userguide/artifact_dependencies_tutorial.html

+0

我忘了發佈gradle主項目,它已經做到了.. –

0

我不知道問題是否在java 8中用gradle,我增加了更多的依賴並且改變了依賴的內部註釋的註釋,正常運行。 我希望這可以幫助其他有同樣問題的人。