admin管理员组文章数量:1406943
I am currently trying to work on my Spring Boot Java Application (Gradle) but IntelliJ (2024.3.4.1) just won't let me work properly. I don't know if I am missing something out but its behavior annoys me and I don't want to give in and let the IDE win with its idea.
So the issue is that I literally specify the dependencies in my gradle file. I have the Spring Boot web and test dependencies but still can't use these components in my code, examples:
- @SpringBootTest
- MockMvc
However, the IDE does suggest that I add it to the class path. But I don't want that. In all my projects which partially were gradle, it has NEVER asked me to do that before and no tutorial suggests me to add them to the class path as IntelliJ wants. When I actually add them, the dependencies work magically.
Am I just doing something wrong? I got quite frustrated trying to get the IDE work as it always does and not even coming to coding after an hour.
And yes, I have deleted the project once and newly cloned it as well as tried to invalidate the caches.
My Gradle:
plugins {
java
id(".springframework.boot") version "3.4.2"
id("io.spring.dependency-management") version "1.1.7"
}
group = "x"
version = "x"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(23)
}
}
repositories {
mavenCentral()
}
dependencies {
// Spring Boot
implementation(".springframework.boot:spring-boot-starter-web")
implementation(".springframework.boot:spring-boot-starter-aop")
implementation("jakarta.servlet:jakarta.servlet-api:6.0.0")
// Spring Test
developmentOnly(".springframework.boot:spring-boot-devtools")
testImplementation(".springframework.boot:spring-boot-starter-test") {
exclude(group = ".junit.vintage", module = "junit-vintage-engine")
}
compileOnly(".jetbrains:annotations:26.0.2")
// Database
runtimeOnly(".postgresql:postgresql")
// JWT
implementation("io.jsonwebtoken:jjwt-api:0.12.6")
runtimeOnly("io.jsonwebtoken:jjwt-impl:0.12.6")
runtimeOnly("io.jsonwebtoken:jjwt-jackson:0.12.6")
}
tasks.withType<Test> {
useJUnitPlatform()
}
本文标签: javaIntelliJ only accepts class path dependencies instead of gradle dependenciesStack Overflow
版权声明:本文标题:java - IntelliJ only accepts class path dependencies instead of gradle dependencies - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744922709a2632394.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论