Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用;梯度-3.5“;构建web应用程序,但在JPA中总是失败_Java_Jpa_Gradle_Web Applications - Fatal编程技术网

Java 使用;梯度-3.5“;构建web应用程序,但在JPA中总是失败

Java 使用;梯度-3.5“;构建web应用程序,但在JPA中总是失败,java,jpa,gradle,web-applications,Java,Jpa,Gradle,Web Applications,Gradle曾试图构建一个web应用程序并打包一个war文件 格雷德尔先生 apply plugin: 'java' apply plugin: 'eclipse-wtp' apply plugin: 'war' sourceCompatibility = 1.8 version = '1.0' compileJava.options.encoding='UTF-8' webAppDirName = 'fbs-report' //set webapp root sourceSe

Gradle曾试图构建一个web应用程序并打包一个war文件

格雷德尔先生

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

sourceCompatibility = 1.8
version = '1.0'
compileJava.options.encoding='UTF-8'
webAppDirName = 'fbs-report'        //set webapp root

sourceSets {
main {
    java {
        srcDir 'src'

        exclude '**/SlablistDload1Controller.java'
        exclude '**/SlablistDload2Controller.java'
        exclude '**/DormantDownloadController.java'
        exclude '**/NewnewController.java'
    }
    resources {
        srcDir 'config'     //prorperties
    }

}
}
repositories {    
 maven { url "http://maven.springframework.org/milestone" }
 maven { url "http://repo.maven.apache.org/maven2" }
 maven { url "http://repo1.maven.org/maven2/" }
 maven { url "http://amateras.sourceforge.jp/mvn/" }
 maven { url "http://repo.springsource.org/libs-release"}
 mavenCentral()

}

configurations {
compile.exclude group: 'org.freemarker', module: 'freemarker'
compile.exclude group: 'javax.servlet', module: 'servlet-api'
compile.exclude group: 'jboss', module: 'javassist'
}

dependencies {

compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
testCompile group: 'junit', name: 'junit', version: '4.+'

compile fileTree(include: ['*.jar'], dir: 'libs')
//spring framework
compile group: 'org.springframework', name: 'spring-context', version: '4.3.7.RELEASE'
compile group: 'org.springframework', name: 'spring-test', version: '4.3.7.RELEASE'
compile group: 'org.springframework', name: 'spring-core', version: '4.3.7.RELEASE'
compile group: 'org.springframework', name: 'spring-beans', version: '4.3.7.RELEASE'
compile group: 'org.springframework', name: 'spring-web', version: '4.3.7.RELEASE'
compile group: 'org.springframework', name: 'spring-webmvc', version: '4.3.7.RELEASE'
compile group: 'org.springframework', name: 'spring-jdbc', version: '4.3.7.RELEASE'
compile group: 'org.springframework', name: 'spring-aop', version: '4.3.7.RELEASE'
compile group: 'org.springframework', name: 'spring-tx', version: '4.3.7.RELEASE'
compile group: 'org.springframework', name: 'spring-context-support', version: '4.3.7.RELEASE'
compile group: 'org.springframework', name: 'spring-aspects', version: '4.3.7.RELEASE'
compile group: 'org.springframework', name: 'spring-oxm', version: '4.3.7.RELEASE'
compile group: 'org.springframework', name: 'spring-orm', version: '4.3.7.RELEASE'
compile group: 'org.springframework', name: 'spring-messaging', version: '4.3.7.RELEASE'
compile group: 'org.springframework', name: 'spring-websocket', version: '4.3.7.RELEASE'
compile group: 'org.springframework', name: 'spring-instrument', version: '4.3.7.RELEASE'

//spring data
compile group: 'org.springframework.data', name: 'spring-data-commons', version: '1.12.6.RELEASE'
compile group: 'org.springframework.data', name: 'spring-data-jpa', version: '1.11.1.RELEASE'
compile group: 'org.springframework.data', name: 'spring-data-rest-webmvc', version: '2.5.6.RELEASE'
compile group: 'org.springframework.data', name: 'spring-data-rest-core', version: '2.5.6.RELEASE'
compile group: 'org.springframework.data', name: 'spring-data-jdbc-core', version: '1.2.1.RELEASE'
compile group: 'org.springframework.data', name: 'spring-cql', version: '1.4.6.RELEASE'
compile group: 'org.springframework.data', name: 'spring-data-rest-parent', version: '2.5.6.RELEASE'

//spring-ws
compile group: 'org.springframework.ws', name: 'spring-xml', version: '2.4.0.RELEASE'
compile group: 'org.springframework.ws', name: 'spring-ws-security', version: '2.4.0.RELEASE'
compile group: 'org.springframework.ws', name: 'spring-ws-test', version: '2.4.0.RELEASE'
compile group: 'org.springframework.ws', name: 'spring-ws-support', version: '2.4.0.RELEASE'

//spring-boot
//compile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '1.4.2.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '1.5.2.RELEASE'
//compile group: 'org.springframework.boot', name: 'spring-boot-starter', version: '1.4.2.RELEASE'
//compile group: 'org.springframework.boot', name: 'spring-boot-autoconfigure', version: '1.4.2.RELEASE'
//compile group: 'org.springframework.boot', name: 'spring-boot-configuration-processor', version: '1.4.2.RELEASE'
//compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: '1.4.2.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot', version: '1.5.2.RELEASE'
//compile group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: '1.4.2.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '1.5.2.RELEASE'
//compile group: 'org.springframework.boot', name: 'spring-boot-starter-logging', version: '1.4.2.RELEASE'
//compile group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc', version: '1.4.2.RELEASE'
//compile group: 'org.springframework.boot', name: 'spring-boot-starter-websocket', version: '1.4.2.RELEASE'
//compile group: 'org.springframework.boot', name: 'spring-boot-devtools', version: '1.4.2.RELEASE'
//compile group: 'org.springframework.boot', name: 'spring-boot-starter-aop', version: '1.4.2.RELEASE'
//compile group: 'org.springframework.boot', name: 'spring-boot-starter-log4j', version: '1.3.8.RELEASE'
//compile group: 'org.springframework.boot', name: 'spring-boot-test', version: '1.4.2.RELEASE'
//compile group: 'org.springframework.boot', name: 'spring-boot-gradle-plugin', version: '1.4.2.RELEASE'
//compile group: 'org.springframework.boot', name: 'spring-boot-deployment-tests', version: '1.4.2.RELEASE'
//compile group: 'org.springframework.boot', name: 'spring-boot-starter-parent', version: '1.4.2.RELEASE'

//hibernate
compile group: 'org.hibernate', name: 'hibernate-core', version: '5.2.5.Final'
compile group: 'org.hibernate', name: 'hibernate-validator', version: '5.3.3.Final'
compile group: 'org.hibernate', name: 'hibernate-entitymanager', version: '5.2.5.Final'
compile group: 'org.hibernate', name: 'hibernate-ehcache', version: '5.2.5.Final'
compile group: 'org.hibernate', name: 'hibernate-c3p0', version: '5.2.5.Final'
compile group: 'org.hibernate', name: 'hibernate-jpamodelgen', version: '5.2.5.Final'
compile group: 'org.hibernate', name: 'hibernate-search-orm', version: '5.5.5.Final'
compile group: 'org.hibernate', name: 'hibernate-tools', version: '5.1.0.Final'
compile group: 'org.hibernate', name: 'hibernate-testing', version: '5.2.5.Final'
compile group: 'org.hibernate', name: 'hibernate-infinispan', version: '5.2.5.Final'
compile group: 'org.hibernate', name: 'hibernate-validator-cdi', version: '5.3.3.Final'
compile group: 'org.hibernate', name: 'hibernate-validator-annotation-processor', version: '5.3.3.Final'
compile group: 'org.hibernate.hql', name: 'hibernate-hql-parser', version: '1.3.0.Final'
compile group: 'org.hibernate.hql', name: 'hibernate-hql-testing', version: '1.3.0.Final'
compile group: 'org.hibernate', name: 'hibernate-java8', version: '5.2.5.Final'
compile group: 'org.hibernate', name: 'hibernate-osgi', version: '5.2.5.Final'
compile group: 'org.hibernate', name: 'hibernate-validator-test-utils', version: '5.3.3.Final'
compile group: 'org.hibernate', name: 'hibernate-validator-osgi', version: '5.3.3.Final'
compile group: 'org.hibernate', name: 'hibernate-gradle-plugin', version: '5.2.5.Final'
compile group: 'org.hibernate', name: 'hibernate-validator-parent', version: '5.3.3.Final'
compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.1-api', version: '1.0.0.Final'
//compile group: 'javax.persistence', name: 'persistence-api', version: '1.0.2'

compile group: 'org.projectlombok', name: 'lombok', version: '1.16.16'

//apache common
compile group: 'javax.activation', name: 'activation', version: '1.1.1'
compile group: 'org.apache.activemq', name: 'activemq-core', version: '5.7.0'
compile group: 'org.apache.activemq.protobuf', name: 'activemq-protobuf', version: '1.1'
compile group: 'annogen', name: 'annogen', version: '0.1.0'
compile group: 'antlr', name: 'antlr', version: '2.7.7'
compile group: 'aopalliance', name: 'aopalliance', version: '1.0'
compile group: 'org.aspectj', name: 'aspectjrt', version: '1.8.10'
compile group: 'org.aspectj', name: 'aspectjweaver', version: '1.8.10'
compile group: 'org.apache.ws.commons.axiom', name: 'axiom-api', version: '1.2.20'
compile group: 'org.apache.axis2', name: 'axis2', version: '1.4.1'
compile group: 'org.apache.axis2', name: 'axis2-saaj', version: '1.4.1'
compile group: 'org.apache.commons', name: 'commons-pool2', version: '2.4.2'
compile group: 'org.apache.poi', name: 'poi', version: '3.9'
//compile group: 'org.quartz-scheduler', name: 'quartz', version: '2.2.3'
compile group: 'org.apache.commons', name: 'commons-dbcp2', version: '2.1.1'
compile group: 'net.sf.json-lib', name: 'json-lib', version: '2.4', classifier: 'jdk15'
//compile group: 'oro', name: 'oro', version: '2.0.8'
//compile group: 'org.freemarker', name: 'freemarker', version: '2.3.23'
//compile group: 'jboss', name: 'javassist', version: '3.22.0-CR1'
compile group: 'commons-fileupload', name: 'commons-fileupload', version: '1.3.2'
compile group: 'commons-io', name: 'commons-io', version: '2.5'
compile group: 'org.jfree', name: 'jcommon', version: '1.0.23'
compile group: 'org.jfree', name: 'jfreechart', version: '1.0.19'
compile group: 'net.minidev', name: 'json-smart', version: '1.0.9'
compile group: 'xerces', name: 'xercesImpl', version: '2.11.0'

}
当我执行
$gradle build
时,总是在任务“compilejava”中失败 以下是误差表的一部分:

D:\fbs-UAT\fbs-report\src\model\MonitorModel.java:62: error: cannot find symbol
classes={
        ^
  symbol:   method classes()
  location: @interface SqlResultSetMapping
D:\fbs-UAT\fbs-report\src\model\ConvertModel.java:114: error: cannot find symbol
        @OneToMany(cascade= { CascadeType.ALL }, fetch=FetchType.EAGER, orphanRemoval=true)
                                                                                          ^
  symbol:   method orphanRemoval()
  location: @interface OneToMany
D:\fbs-UAT\fbs-report\src\model\MonitorModel.java:66: error: duplicate element '<any?>' in annotation @<any?>.
                        @ColumnResult(name="sysId", type=Long.class),
                                  ^
D:\fbs-UAT\fbs-report\src\model\MonitorModel.java:66: error: duplicate element '<any?>' in annotation @<any?>.
                        @ColumnResult(name="sysId", type=Long.class),
                                                ^
D:\fbs-UAT\fbs-report\src\model\MonitorModel.java:67: error: duplicate element '<any?>' in annotation @<any?>.
                    @ColumnResult(name="sysCreateUser", type=String.class),
                              ^
D:\fbs-UAT\fbs-report\src\model\MonitorModel.java:67: error: duplicate element '<any?>' in annotation @<any?>.
                    @ColumnResult(name="sysCreateUser", type=String.class),
                                                    ^
D:\fbs-UAT\fbs-report\src\model\MonitorModel.java:68: error: duplicate element '<any?>' in annotation @<any?>.
                    @ColumnResult(name="sysCreateTime", type=Date.class),
                              ^
D:\fbs-UAT\fbs-report\src\model\MonitorModel.java:68: error: duplicate element '<any?>' in annotation @<any?>.
                    @ColumnResult(name="sysCreateTime", type=Date.class),
                                                    ^
D:\fbs-UAT\fbs-report\src\MonitorModel.java:69: error: duplicate element '<any?>' in annotation @<any?>.
                    @ColumnResult(name="sysModifyUser", type=String.class),
                              ^
D:\fbs-UAT\fbs-report\src\model\MonitorModel.java:69: error: duplicate element '<any?>' in annotation @<any?>.
                    @ColumnResult(name="sysModifyUser", type=String.class),
                                                    ^
D:\fbs UAT\fbs report\src\model\MonitorModel.java:62:错误:找不到符号
班级={
^
符号:方法类()
位置:@接口SqlResultsMapping
D:\fbs UAT\fbs report\src\model\ConvertModel.java:114:错误:找不到符号
@OneToMany(cascade={CascadeType.ALL},fetch=FetchType.EAGER,orphanRemoving=true)
^
符号:方法删除()
位置:@interface-OneToMany
D:\fbs UAT\fbs report\src\model\MonitorModel.java:66:错误:注释@中的元素“”重复。
@ColumnResult(name=“sysId”,type=Long.class),
^
D:\fbs UAT\fbs report\src\model\MonitorModel.java:66:错误:注释@中的元素“”重复。
@ColumnResult(name=“sysId”,type=Long.class),
^
D:\fbs UAT\fbs report\src\model\MonitorModel.java:67:错误:注释@中的元素“”重复。
@ColumnResult(name=“sysCreateUser”,type=String.class),
^
D:\fbs UAT\fbs report\src\model\MonitorModel.java:67:错误:注释@中的元素“”重复。
@ColumnResult(name=“sysCreateUser”,type=String.class),
^
D:\fbs UAT\fbs report\src\model\MonitorModel.java:68:错误:注释@中的元素“”重复。
@ColumnResult(name=“sysCreateTime”,type=Date.class),
^
D:\fbs UAT\fbs report\src\model\MonitorModel.java:68:错误:注释@中的元素“”重复。
@ColumnResult(name=“sysCreateTime”,type=Date.class),
^
D:\fbs UAT\fbs report\src\MonitorModel.java:69:错误:注释@中的元素“”重复。
@ColumnResult(name=“sysModifyUser”,type=String.class),
^
D:\fbs UAT\fbs report\src\model\MonitorModel.java:69:错误:注释@中的元素“”重复。
@ColumnResult(name=“sysModifyUser”,type=String.class),
^

顺便说一句,如果去掉JPA的代码,结果是成功的。

如果添加对JPA 1.0.2的依赖,编译将失败,因为您的一些注释依赖于JPA 2.1


由于
'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final'
已经包含jpa 2.1 api,您不需要对
javax单独依赖。persistence:persistence api

而不是附加图像,请添加
build.gradle
的源代码和错误消息。目前还不够信息。你在使用什么库?在谷歌上搜索我发现的错误消息,例如这个bug报告:非常感谢。删除“persistence api.jar”后,它工作得很好。