Impact of combining projects in the build path on servlets
I am writing an application in Eclipse, that has a servlet, and an android component. There are common classes to both so, being a bit of noob, I have moved the common classes into a new project to centralise the common code.
I then reference the common classes in my servlet and the android project by including the "common class" project in the build path for each. I do not get any compile errors as a result of using the, now centralised, common cl开发者_StackOverflowasses.
My concern is the impact on the servlet. When deploying the jar for the servlet, I merely export all my .class files and push it onto the server. Will the common classes project be automatically included now that I have included an additional project as well ?
If you have better ideas or best practice architecting common classes/multi-project builds, I am also interested to hear.
If you set up your common code project as a dependancy in the build path of the servlet project then you can use ant build scripts to grab everything you need.
here is the ant help page for eclipse
When referencing your common code project for your Android application, be sure to Identify your common project as an android library (right click on project -> Properties -> Android (on the left) -> check the check box that says this is an Android library) and then be sure to set the Android library reference in your Android application project (right click on project -> Properties -> Android (on the left) -> click "Add" in the Libraries box and select your common code project).
here is more about android projects and library projects
精彩评论