如何在Eclipse中引用一个不同的Java项目 [英] How to reference a different Java project in Eclipse

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

问题描述

我有Project1和Project2。 Project1依赖Project2。
我有点厌倦每次在Project2中进行一些代码更改时,都必须导出Project2 JAR文件,并将其复制到Project1的lib文件夹中。



有没有办法自动实现?或者,有没有什么其他方式让Project1有一些变化?



在项目的Build Path中,有一种方法来指定参考到Workspace中的其他项目,但这似乎什么都不做?它实际上是做什么?



我正在阅读某处,我可以使用部署属性来自动化此过程,但我找不到。



更新:
呃,我是C#开发人员,在Java开发方面有一些经验(主要是Android开发),我可能会问愚蠢的问题,所以请承担与我...



Project1是标准的Java项目(在客户机上运行,​​使用swing等)。
Project2是动态Web项目(对我来说,不明原因)。它唯一的做法是调用webservice(第三个项目我不需要担心),并将结果传回给Project1。 Project2包含那些Axis2 webserviceStub.java文件...每个知道,然后,我必须重新创建这些存根文件,然后我必须导出JAR文件并将其移动到Project1。 Project2虽然是Web Project,但它实际上是在客户端上运行的代码。



在Build Path中简单的项目引用对我来说不起作用。 >

谢谢

解决方案

右键单击 Project1 然后点击属性。在出现的对话框中,选择 Java构建路径,然后单击项目选项卡。在这里,将Project2添加到构建路径。



如果Project1 是一个Web应用程序,则需要确保您的部署程序集(相同的属性 UI)也有 Project2


I have Project1 and Project2. Project1 is dependent of Project2. I am sort of tired that every time I make some code changes in Project2, I have to Export Project2 JAR file, and copy it into lib folder of Project1.

Is there a way to achieve this automatically? Or, is there any other way to let know Project1 that Project2 had some changes?

In Build Path of the project, there is a way to specify references to other projects in Workspace, but this doesn't seem to do anything? What does it actually do?

I was reading somewhere that I can use Deployment Properties to automatize this process, but I can't find it.

UPDATE: Uh, I am C# developer and have some experience in Java development (mostly Android development), I might ask stupid questions, so please bear with me...

Project1 is standard Java Project (Run on client's machine, uses swing, etc..). Project2 is Dynamic Web Project (for to me unknown reason). The only thing it does is calling webservice (third project I don't need to worry about) and passing result back to Project1. Project2 contains those Axis2 webserviceStub.java files... Every know and then, I have to recreate these stub files then I have to export JAR file and move it to Project1. Project2, even though it is Web Project, it is actually code that runs on client.

Just simple project referencing in Build Path doesn't work for me.

Thanks

解决方案

Right click on Project1, then click on Properties. In the dialog that comes up, select Java Build Path, and then click on the Projects tab. There, add Project2 to the build path.

If Project1 is a web app, you need to make sure your Deployment Assembly (same Properties UI) has Project2 there as well.

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

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