gpt4 book ai didi

java - 更新 build.gradle 会从类路径中删除库

转载 作者:行者123 更新时间:2023-12-02 10:37:13 24 4
gpt4 key购买 nike

我用gradle创建了spring mvc项目,但遇到以下问题。

我知道这个问题的解决方案很简单,但我还没有找到。

这是 HibernateConfiguration.java 中的代码:

enter image description here

这是build.gradle文件:

plugins {
id 'java'
id 'war'
}

group 'com.gtu.gtesting'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
testCompile group: 'junit', name: 'junit', version: '4.12'

//---
testCompile group: 'org.springframework', name:'spring-core', version:'5.1.2.RELEASE'
testCompile group: 'org.springframework', name:'spring-tx', version:'5.1.2.RELEASE'
testCompile group: 'org.springframework', name:'spring-beans', version:'5.1.2.RELEASE'
testCompile group: 'org.springframework', name:'spring-orm', version:'5.1.2.RELEASE'
testCompile group: 'org.springframework', name: 'spring-mvc', version: '5.1.2.RELEASE'
testCompile group: 'org.springframework', name: 'spring-webmvc', version: '5.1.2.RELEASE'
testCompile group: 'org.hibernate', name: 'hibernate-core', version: '5.3.7.Final'
testCompile group: 'mysql', name: 'mysql-connector-java', version: '8.0.13'
testCompile group: 'javax.servlet', name: 'jstl', version: '4.0.1'
testCompile group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
testCompile group: 'javax.persistence', name: 'javax.persistence-api', version: '2.2'
testCompile group: 'javax.persistence', name: 'persistence-api', version: '1.0.2'
testCompile group: 'javax.servlet', name: 'servlet-api', version: '3.0-alpha-1'
}

更新 build.gradle 文件后(例如添加/删除依赖项后):

我在每个文件中都遇到了未解析的符号:

enter image description here

最佳答案

testCompile group组更改为compile group

关于java - 更新 build.gradle 会从类路径中删除库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53190529/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com