Eclipse“这个编译单元不在java项目的构建路径上" [英] Eclipse "this compilation unit is not on the build path of a java project"

查看:67
本文介绍了Eclipse“这个编译单元不在java项目的构建路径上"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在 Eclipse 中使用自动完成功能.

I can't get autocompletion to work in Eclipse.

我正在 svn 上进行项目.我通过进入

I'm working on the project on svn. I set up the project in Eclipse by going into

文件 ->导入 ->结帐作为项目 ->新建项目向导.

File -> Import -> Checkout As a Project -> New Project Wizard.

我选择了企业 Java 应用程序.一切似乎都工作正常,除了没有像我预期的那样自动完成工作,我得到了一个显示消息的弹出对话框

I chose Enterprise Java Application. Everything seemed to work fine except instead of autocompletion working as I expected I got a popup dialog displaying the message

此编译单元不在 java 项目的构建路径上.

This compilation unit is not on the build path of a java project.

我在谷歌上搜索过,每个人都说这个项目必须是一个 Java 项目,但它是!有什么问题?

I've Googled it and everyone says that the project must be a Java project, but it is! What is the problem?

svn 上的目录结构如下所示:

The catalog structure on svn looks like this:

-Project_name
  -application
     -META-INF
       application.xml
       MANIFEST.MF
  +build
  +db
  +deploy
  +dist
  +lib
  +properties
  +script
  -src
     -META-INF
        someother.xml (datasource info)
        persistence.xml
        folder hierarchy with source files (should be package)
  -web
     some folders
          .
          .
     files
       .
       .
     -WEB-INF
        faces-config.xml
        jboss-web.xml
        web.xml
     build_win.xml

如何告诉 Eclipse 源文件文件夹、application.xml 和其他配置 xml 文件的位置?

How do I tell Eclipse where the source files folder, application.xml, and other configuration xml files are?

推荐答案

当您在父项目下有一个多模块 Maven 项目时,请确保您没有在 Maven 父项目中编辑该文件.

When you have a multimodules maven project under a parent project, make sure you're not editing the file in the maven parent project.

这篇关于Eclipse“这个编译单元不在java项目的构建路径上"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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