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

前端 未结 12 2151
迷失自我
迷失自我 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:37

    right click project --> properties --> maven --> lifecycle mapping --> check (skip maven compiler plugin) click ok now the build path appears . nw do the necessary changes

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

    Problem was solved simply by deleting the project from my workspace, deleting all .project, .classpath files and .settings folders, and re-importing. I don't know why it didn't work the first time. Thanks for the help, everyone.

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

    Make sure if you have M2 plugin in Eclipse, you have Maven 2.7 above installed in your system.

    After that run mvn eclipse:clean then mvn eclipse:eclipse.

    .classpath and .project will be created in your project folders. Everything should be fine.

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

    The Project nature is decided by the .project file in Eclipse, which also dictates to Eclipse about the Parent Source Code, and Test Folders.

    Update/Modify the .project file as follows, using which We retain the Maven Compatibility and Java Nature of the Project.

    .project.xml under the Eclipse Project folder

    <?xml version="1.0" encoding="UTF-8"?>
    <projectDescription>
            <name>java-cgdk-en</name>
            <comment></comment>
            <projects>
            </projects>
            <buildSpec>
                    <buildCommand>
                            <name>org.eclipse.jdt.core.javabuilder</name>
                            <arguments>
                            </arguments>
                    </buildCommand>
            </buildSpec>  
            <natures>
                    <nature>org.eclipse.jdt.core.javanature</nature>
            </natures>
    </projectDescription>
    
    0 讨论(0)
  • 2020-12-24 08:49

    Install m2e and subclipse from the Eclipse Marketplace depending on what version of Eclipse you have. Then:

    1. Open Eclipse go to Window > Open Perspective > Other... > SVN Repository Exploring.
    2. Add your svn url to SVN repository/code base.
    3. Select a project. Right Click and select Checkout.
    4. Assuming your project has a pom.xml, switch back to your Java perspective, select the project that was just imported, right click and select Configure > Convert to Maven Project.

    It should now be recognized as both a Maven and a Java project (Maven and Java natures will have been added to the Eclipse .project file)

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

    I'm using Version: Indigo Service Release 2 Build id: 20120216-1857

    I also found that after I installed the Maven plugin that 'Project Explorer' - Right click on 'my project' did not list option "Maven" or "configure".

    On reading the above, I tried doing the same on "Package Explorer" and to my surprise it worked. And now 'Project Explorer' works too!

    0 讨论(0)
提交回复
热议问题