我试图编制gradle,我收到此错误,有人知道如何解决?
注意只有在执行应用程序的构建时,应用程序才能正常运行此错误。
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 :(得分:0)
您需要告诉gradle如何解决所有依赖项。你可以使用你喜欢的任何回购。您可以通过提供如下存储库闭包来实现此目的:
.....
ext.servletApiVersion ='2.5'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
....
因此,这将尝试使用maven repo来解决依赖关系。这里有更多信息: https://docs.gradle.org/current/userguide/artifact_dependencies_tutorial.html
答案 1 :(得分:0)
我不知道问题是否在带有gradle的java 8中,我添加了更多的依赖性并改变了内部注释依赖的注释,正常运行。 我希望这可以帮助那些有同样问题的人。