如何设置项目引用Eclipse [英] How to set up project references Eclipse

查看:202
本文介绍了如何设置项目引用Eclipse的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作空间中有一个Web项目,它依赖于工作区中的一个java项目。
在项目引用中,我使我的Web项目引用了java项目,但是仍然存在构建错误,表明我的Java项目中没有引用我的Java项目中的类。

I have a web project in my workspace that has a dependency on a java project in the workspace. In project references, I made my web project reference the java project, but there are still build errors that indicate that classes in my java project are not referenced by my web project.

推荐答案

答案



这不是您问题的直接答案,而是解决问题的方法正在经历
必须为您的Web项目部署 java项目,以在除eclipse调试环境之外的任何环境中运行。我假设部署技术是一个JAR文件。

An Answer

This is not a direct answer to your question, but is an solution to the problem you are experiencing. The java project must be deployed for your web project to run in any environment other than you eclipse debug environment. I assume that the deployment technique is a JAR file.


  1. 构建 java项目。也就是说,生成可部署的jar文件。我将其称为XYZ.JAR文件。

  2. 将XYZ.JAR文件放在 web项目的/ WEB-INF / lib中。 >
  1. Build the java project. That is, produce the deployable jar file. I will call this the XYZ.JAR file.
  2. Put the XYZ.JAR file in the /WEB-INF/lib of your web project.



您的问题的可能答案



检查以下内容,我怀疑您的答案在于:

Possible answer to your question

Check the following, I suspect your answer lies therein:


  • Java项目的JDK兼容性是否与 Web项目的JDK兼容性不同的?较高的网络项目很好。

  • 您是否构建了 Java项目

  • java项目的自动构建集。我建议你设置自动构建。

  • 尝试运行 清洁 ,然后一个 构建 Java项目上,然后在 web项目上相同。

  • 你说 I>。您是否意味着您在 web项目的Properties!Java Build Path!Projects选项卡中添加了对 java项目的引用?如果答案是否定的话,你应该加一个。注意:这对于编译是很好的,但是一旦部署,就不会有任何帮助。

  • 您是否设置了一个用于部署 java项目的EAR文件 web项目(如果您正在部署到Tomcat等servlet容器,则不适用)?如果是,则在 web项目的属性!J2EE模块依赖关系中添加对 java项目的引用

  • Is the JDK Compliance of the java project different from the JDK compliance of the web project? Higher on the web project is fine. Lower on the web project will not work.
  • Did you build the java project?
  • Is automatic build set for the java project. I suggest that you sould set auto build.
  • Try running a clean then a build on the java project then the same on the web project.
  • You say dependancy. Do you mean that you added a reference to the java project in the Properties!Java Build Path!Projects tab of the web project? If the answer is no, then you should add one. Note: this is fine for compilation, but in no way helps once you deploy.
  • Have you setup an EAR file with which to deploy the java project and the web project (not applicable if you are deploying to a servlet container such as Tomcat)? If yes, then add a reference to the java project in the Properties!J2EE Module Dependencies of the web project

这篇关于如何设置项目引用Eclipse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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