导入的maven项目不会显示为java项目。显示文件夹 [英] imported maven project does not appear as java project. Shows folders

查看:652
本文介绍了导入的maven项目不会显示为java项目。显示文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将现有项目源代码从SVN检出到系统中的文件夹。
然后我打开eclipse。导入项目 - >现有的Maven项目。



导入时没有问题。但是,Project Explorer将其显示为只是文件夹而不是包。 (就像我们创建一个包,然后添加类,它显示一个不同的图标为包root)。我也打开了Navigator和Package Explorer。但是他们也将它们显示为文件夹。



我试过:

  mvn eclipse:clean 
mvn eclipse:eclipse

在项目的根目录。但是这没有帮助。



任何人都可以帮助这个?



我的文件夹结构:

  ecs-> 
ecs-ejb->
src / java / main / com / xxx
pom.xml
ecs-> ear->
src / java / main / com / xxx
pom.xml
pom.xml


解决方案

尝试:


  1. 右键单击项目 - >配置 - >转换为Maven项目

----编辑----



如果这不起作用,有可能有人将他们的环境文件检入SVN。如果他们签到:




  • .project

  • .classpath

  • 它们可能与您的环境(eclipse的不同设置/插件/版本...)冲突。尝试删除您的项目,删除文件夹/文件,然后从SVN中删除这些文件,并重复您的初始过程。所有这些文件/文件夹将在导入eclipse时生成。



    ----编辑2 ----



    根据您最近编辑的问题,您有一个多模块项目。如果您只在父项目上执行此操作,则不存在源文件夹。所以你不会看到它。您应该:


    1. 文件 - >导入...

    2. 选择现有的Maven项目, / li>
    3. 将根目录设置为ecs / ecs-ejb,完成

    4. 对所有其他模块重复。

    在eclipse中,多模块maven项目的每个模块都需要自己的eclipse项目。


    I checked out the existing project source code from SVN to a folder in my system. Then I opened eclipse. Import Project-> Existing Maven Project.

    It imported without issues. However, Project Explorer shows it as just folders instead of packages. (Like when we create a package and then add classes to it, it shows a different icon for package root). I opened Navigator and Package Explorer as well. But they are showing them as folders as well.

    I tried:

    mvn eclipse:clean
    mvn eclipse:eclipse
    

    on the root of the project. But it did not help.

    Can anyone help on this one?

    My folder structure:

    ecs->
         ecs-ejb->
            src/java/main/com/xxx
            pom.xml
         ecs->ear->
            src/java/main/com/xxx
            pom.xml
         pom.xml
    

    解决方案

    Try to:

    1. Right click the project->Configure->Convert to Maven Project

    ---- Edit ----

    If this doesnt work, it is likely that someone checked in their environment files into your SVN. If they checked in:

    • .project
    • .classpath
    • .settings/

    They could be conflicting with your environment (different settings/plugins/versions of eclipse...). Try dropping your project, deleting the folder/files, then remove these files from SVN, and repeat your initial process. All of these files/folders will get generated during the import to eclipse.

    ---- Edit 2 ----

    Per your recent edit to the question, you have a multi-module project. If you only did this on the parent project, then there is no source folder. So you wouldn't see it. You should:

    1. File->Import...
    2. Choose Existing Maven Projects, Next
    3. Set the Root Directory to ecs/ecs-ejb, Finish
    4. Repeat for all other modules.

    In eclipse, each module of a multi-module maven project needs its own eclipse project.

    这篇关于导入的maven项目不会显示为java项目。显示文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆