"package does not exist" error, despite autocomplete being aware of them

已回答

I'm using classes from a project I have as a dependency, the editor seems to be completely aware of this - it even offered me the appropriate classes when I manually deleted the import statements, and I can see the library in the Project tree under External Libraries, nevertheless, I get a "java: package ... does not exist" upon compilation.

I have tried the Maven>Reimport option, downloading and generating sources, no dice.

Any ideas? Thanks!

9

Hi guys :)

Got the same issue: 

"error: package org.junit.platform.engine does not exist
import org.junit.platform.engine.TestExecutionResult;"

Please take a look at my project here "Upload id: 2021_06_30_2zrKd9mRucyz1oqk (file: JiraGradleIntegration_NEW.zip)"

Also have no idea why I'm offered to import package to classpath instead of general import.

Would be very grateful for any help!

0

Brad Groove You have JUnit dependencies in the test scope, while your code that is trying to use these dependencies is located in the main scope, hence the problem. Move your test code to src/test/java from src/main/java.

The issue is not related to IntelliJ IDEA in any way and you will get exactly the same error when trying to build this project from the command line Gradle.

There are other dependency issues with your project as well (lombok dependency is missing). Fix the issues so that the project can be built outside of the IDE and it will work in IntelliJ IDEA as well. If you have generic questions about Gradle dependencies, feel free to use https://stackoverflow.com/ for help.

0

hello i have same errors. Please can you help me. I did everything you wrote here but the errors show up again. here is screenshot.

0

and i uploaded the file,Upload id: 2022_01_09_9CMKB2Wi1z8sVvDb (file: spring-boot-react-oauth2-social-login-demo2.rar)

0

Fatma Algan your sample project builds without errors:

0

So, what can cause the errors when i build on my computer and IDE?

0

Try to delete .idea directory and reimport the project from pom.xml, make sure Maven import completes without errors and all the libraries get downloaded and attached to the project.

0

It didn't solve the errors. my IDE version was 2021.3.1, i uninstalled it and installed 2021.2.4. there are no errors now. thank you for the support.

0

请先登录再写评论。