Maven project not being treated as Java in Eclipse

后端 未结 14 720
星月不相逢
星月不相逢 2021-02-05 04:30

I\'m working on a project that has lots of different Maven projects. I\'ve been doing a bunch of JUnit testing on these projects, and usually this goes well. I open up Eclipse

14条回答
  •  清歌不尽
    2021-02-05 04:57

    I also tried all the approaches described in this thread. Modifying only .project is not enough because the maven libraries will not be used for building the project and the project build will fail. mvn eclipse:eclipse will create a long and useless .classpath without actually using m2e.

    The easiest way is to create a new java project, convert it to the Maven project and open the .project and .classpath for this new project. Then make similar changes for the imported Maven project.

    The important changes for the .project file have been described but in order to use the Maven dependencies in Eclipse something like this should be in the .classpath file

    
            
                
            
        
        
            
                
            
        
    

    Using facets is not an option in this case because with facets Eclipse doesn't use m2e and the maven dependencies. Again the dependencies with facets have to be managed manually.

    I tried all this with Eclipse 4.6.2 Neon.

提交回复
热议问题