@XmlElement( "name" ) ^ 符号: 类 XmlElement gradle 错误?



我正在尝试编译gradle,我遇到了这个错误,有人知道如何解决吗?
注意只有在执行应用程序构建时,应用程序才会在出现此错误的eclipse上正常运行。

E:VirtualBoxprojetonextinfoweb>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:VirtualBoxprojetonextinfowebsrcmainjavabrcomnextinfomultimediawebmodelDisplayDigital.java:8: error: package com.sun.xml.internal.txw2.annotation does not exist 
import com.sun.xml.internal.txw2.annotation.XmlElement;

我的渐变文件

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'
  }

您需要告诉gradle如何解析所有依赖项。你可以使用任何你喜欢的回购。您可以通过提供这样的存储库关闭来做到这一点:

.....
ext.servletApiVersion ='2.5'
repositories {
    mavenLocal()
    mavenCentral()
}
dependencies {
....

因此,这将尝试使用maven repo来解决依赖关系。这里有更多信息:https://docs.gradle.org/current/userguide/artifact_dependencies_tutorial.html

我不知道问题是否在带有gradle的java 8中,我添加了更多的依赖,并更改了内部依赖注释的aa注释,功能正常。我希望这能帮助其他有同样问题的人。

最新更新