Maven project not being treated as Java in Eclipse

后端 未结 14 747
星月不相逢
星月不相逢 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 05:13

    There are two ways this can be achieved.

    1) By Changing the project nature. Right-click on Project -> Properties -> Project Natures, then choose all natures that apply for your case (e.g. java).

    (OR)

    2) By updating the .project file and add all the natures that are required for the project. This .project file is located at the root folder of the project. If the file does not exist for any reason, create a new file, and add the sections for each nature that is required e.g., as follows.

    
    
            yourprojectName
            
            
            
            
                    
                            org.eclipse.jdt.core.javabuilder
                            
                            
                    
                    
                            org.eclipse.wst.common.project.facet.core.builder
                            
                            
                    
                    
                            org.eclipse.m2e.core.maven2Builder
                            
                            
                    
            
            
                    org.eclipse.wst.common.project.facet.core.nature
                    org.eclipse.jdt.core.javanature
                    org.eclipse.m2e.core.maven2Nature
            
     
    

提交回复
热议问题