开发者

Importing auto-compiled Jar from external project in Eclipse

I searched for a while, but I couldn't figure out how to solve my problem :

I have a Java project which is a library I ship to customers. For testing purposes, I have a "Test" project in which the library should be included. I used to options :

  • Export the library as a Jar, and import it in my test project when I make a change

This method takes too long when I fix bugs, and if someone else makes a change to the library, I might not know and forget to do it again.

  • Link the "src" folder of my library to the test project

I had different behaviors 开发者_StackOverflow社区using this method : some issues did not appear with the linked source which did with the Jar file... don't know why.

When I program in Objective-C (in XCode), I have a reference to a "target" of the library project, which auto-compiles when I compile the test project, I'd like to have the same structure using Eclipse.

Any of you know how to do this ?

Thank you !

Julien


With Link the "src" folder of my library do you mean you add the sources of the other project to the test project? In eclipse you can define a project dependency as part of the Java build path properties, that might do what you need.

Another option is to add an ant build.xml to produce the .jar file, but I don't think you can get eclipse to run the ant build file just before you run your test project automatically the way you can with a Makefile in the C world.


Maybe you could use Maven. You could create parent project for both your library and your test application. Each time you will compile the whole project maven would compile your library first and then your test app. You could also create your own mvn repo deploy your library as independent artifact and add that artifact to your test app dependency. Once you will update your library artifact in your mvn repo then it then the change will be automatically detected by the maven during test application compilation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜