Eclipse 3.4 GWT 1.6 project - how to reference source from other projects?

前端 未结 8 1892
迷失自我
迷失自我 2020-12-14 02:23

I\'ve got a GWT 1.6 project in Eclipse 3.4 and am trying to reference source from another (non-GWT) project in my workspace. I\'ve added the project to my

相关标签:
8条回答
  • 2020-12-14 03:14

    I know this post is quite old but as I spent quite a lot of time on this issue and finally found the way to do it, I thought I might share the answer :

    once you've created your launch configuration, open it run>run configurations... go to classpath tab and select user entries. add advanced>folder and select the source folder of your other module project. If as me you've separated the module conf file in a src/main/resources folder you have to add it as well.

    should work.

    0 讨论(0)
  • 2020-12-14 03:19

    This is a fantastic solution of your problem proposed by Sven Buschbeck (must a norwegian, lol!), worked for me!

    When work­ing on sev­eral large scale projects (in Eclipse), it’s con­ve­nient and of course more effi­cient to share and reuse code via com­mon libraries. While those are in an early stage they need to be changed a lot and there­fore it’s handy to link projects in instead of cre­at­ing new jars each time the library has been updated. Unfor­tu­nately, this stan­dard approach for Java devel­op­ment in Eclipse does not work that straight for­ward as with plain old Java projects, it requires three steps in total:

    1. Link the library project to all rel­e­vant projects (“Project Pref­er­ences” -> “Java Build Path” -> “Projects” -> “Add…”)
    2. Then, add the client-side code of the library (by adding it as a mod­ule.) There­fore, edit the gwt.xml of your appli­ca­tion and add for exam­ple where Super­Lib is the file name of the gwt.xml file in you library project and before that is the pack­age it lies in.
    3. Add the code to the project by link­ing a source folder. Unfor­tu­nately, this is required if you do not want to write an Ant script to com­pile your appli­ca­tion. (If you pre­fer Ant check this out) I don’t like the idea of using such a script because if you for­get to run it each time you make changes, you will end up in confusion—let’s go for the con­ve­nient, auto­matic way then.

      • Add a folder to your appli­ca­tion project; open the “advanced” sec­tion in the folder cre­ation dia­log, select “Link to alter­nate loca­tion” and pick the source folder (usu­ally “src”) of your library project. (Hint: if you work within a team using a ver­sion­ing sys­tem, you can cre­ate a vari­able for that folder and use this instead. This way, each of your col­leagues can put the library project in a dif­fer­ent folder and accom­mo­date for that by adjust­ing the vari­able :) )

      • Right click the folder, “Build Path” -> “Use as Source Folder”. Done. Sur­pris­ingly, the GWT plu­gin for Eclipse does not honor the project link­ing, thus all the ref­er­ences need to be made explicit or you will end up with lots of the fol­low­ing: ClassNotFoundException.

    0 讨论(0)
提交回复
热议问题