2015-11-26 89 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,我增加了更多的依赖并且改变了依赖的内部注释的注释,正常运行。 我希望这可以帮助其他有同样问题的人。