在坐了一段时间后,我回到了一个IntelliJ项目,突然,它找不到任何Spring Web类,比如@RestController。导入出错,因为它们在org.springframework包中找不到任何东西。
我尝试使缓存无效并重新启动,但没有帮助。这是我的build.gradle。
plugins {
id 'org.springframework.boot' version '2.4.0'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
id 'groovy'
}
group = 'us.square1tech'
version = '0.9.1'
sourceCompatibility = '11'
repositories {
mavenCentral()
// Spock snapshots are available from the Sonatype OSS snapshot repository
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
//internal dependencies
// for heavyweight software dependencies
flatDir {
dirs 'libs'
}
}
dependencies {
// internal libraries
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation (
'org.slf4j:slf4j-log4j12:2.0.0-alpha1',
'org.bouncycastle:bcprov-ext-jdk16:1.46',
'net.sf.dozer:dozer:5.5.1',
'org.apache.httpcomponents:httpclient:4.5.8',
'com.fasterxml.jackson.core:jackson-core:2.12.0'
)
implementation (
'org.springframework.boot:spring-boot-starter-data-jpa',
'org.springframework.boot:spring-boot-starter-web'
)
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation group: 'junit', name: 'junit', version: '4.12'
// mandatory dependencies for using Spock
testImplementation('org.codehaus.groovy:groovy:3.0.5')
testImplementation ('org.spockframework:spock-core:2.0-M2-groovy-3.0') {
exclude group: 'org.codehaus.groovy'
}
testImplementation 'org.spockframework:spock-core'
// optional dependencies for using Spock
testImplementation (
'org.hamcrest:hamcrest-core:1.3', // only necessary if Hamcrest matchers are used
'net.bytebuddy:byte-buddy:1.9.3', // allows mocking of classes (in addition to interfaces)
'org.objenesis:objenesis:2.6' // allows mocking of classes without default constructor (together with CGLIB)
)
runtimeOnly 'com.h2database:h2'
}
test {
useJUnitPlatform()
}发布于 2021-07-20 19:58:14
我仍然不知道发生了什么,但我只是从源代码管理中签出并创建了一个新项目。我猜是IntelliJ中的一些腐败的东西。
https://stackoverflow.com/questions/68454293
复制相似问题