Issues with maven project running in eclipse, not recognized as Java project

前端 未结 12 2152
迷失自我
迷失自我 2020-12-24 08:22

I\'ve imported an existing maven project into Eclipse. I tried to set up the configurations for a JUnit test, and my project wouldn\'t come up as a testable project. When I

相关标签:
12条回答
  • 2020-12-24 08:55

    Make sure that POM doesn't have any error, Eclipse detecting the project types based on the initial build (automatically or manual).

    0 讨论(0)
  • 2020-12-24 08:56

    I've run mvn eclipse:eclipse
    I've right-clicked the project in the PackageExplorer > Maven > Update Project Configuration

    Those two should be mutually exclusive. Either you manage a project from the outside using eclipse:eclipse or from the inside using m2eclipse. Don't mix them.

    Possible cause of the problem:

    The packaging is POM (perhaps this is the root of a multi-module project, in which case you have to import the module projects). m2eclipse doesn't add the Java nature to POM projects (nor does eclipse:eclipse, btw)

    0 讨论(0)
  • 2020-12-24 08:56

    I had what seemed like the same issue. In my case, I was checking out a Maven project that contained multiple (parent/child) poms.

    If the highest level Maven project within your repository/branch simply manages child poms, it may not contain Java definitions at all. You will need to open these child projects as an independent project within Eclipse.

    You can do this by right clicking on your project -> Import -> Maven -> Existing Maven Projects -> then select child project you are wanting to change.

    0 讨论(0)
  • 2020-12-24 09:02

    I got stuck in similar situation but I realized that since I am trying to change in the parent collection you cannot find eclipse intellisense due to the fact that it is just holding the projects. Try working on exclusive project created by maven.

    0 讨论(0)
  • 2020-12-24 09:03

    pls follow the below website.. Right click on the project, go to Properties, then select Project Facets. this will convert it to a java/dynamic web projects for the use.

    0 讨论(0)
  • 2020-12-24 09:03

    Check the packaging tag in the pom.xml file.

    It worked when I changed pom.xml to use:

    <packaging>jar</packaging>
    
    0 讨论(0)
提交回复
热议问题