IntellijIDEA not recognizing classes specified in Maven dependencies

后端 未结 24 1915
醉梦人生
醉梦人生 2021-01-30 12:57

I have a project in IntellijIDEA which was created with Maven. I then specified a set of dependencies and external repositories in the Pom.xml file.

The project builds

24条回答
  •  臣服心动
    2021-01-30 13:26

    Ran into the "same" issue some days ago. It might not be related as my issue was more specific to Spring boot but as I was struggling with it and tried every solution on this post I'm going to share my experience.

    What I was trying to do is to add one of my spring boot app into another project as a maven dependency. The dependency was resolved but I couldn't access my classes.

    When no packaging is declared, Maven assumes the default packaging is JAR. The JAR generated by the Spring Boot Maven Plugin overrides the default one generated by Maven.

    The solution was:

    The solution that we found is to generate another JAR which will be used as a dependency to be imported from other projects.

    The full article which helped me solve my issue.

    Hope it helps someone.

提交回复
热议问题