still - link eclipse project to git repository

How to share web content between eclipse projects (4)

I believe writing your own scripts (e.g. custom build steps using ant, easily configurable in eclipse) is among the more practical solutions.

You could also create multiple webapps and reference their respective resources - this would be easy with css, images and the like, not so much with jsp that need to access your code being available.

I can imagine some tricks with tomcats crossContext="true" option for the context (e.g. webapplication), enabling one application to access classes in an other application, but haven't tried them yet.

Sorry - I believe that's not the answer you'd like to hear...

While the J2EE module reference feature allows your to create common Java library projects, I can't find a neat way to do this for web content.

I have common JSPs, CSS files, JavaScript libraries and even descriptor fragments that I would like to use across a number of Dynamic Web Projects, so that these artefacts are edited i only one place, but will be exported into each of the Dynamic WebProject WAR files.

I am surprised that I can't find a way to promote reusability in the web space without writing my own scripts and hooking into the export process.

Is there a way to do this? Thanks. Matt.

I use eclipse for a few JEE web projects lately. What I do is:

When I'm developing, I have my webserver(tomcat) serve files from my WebContent folder. All my non-built files go in here, including images and all web stuff. This lets me make a change and immediately run it in a browser without having to build anything.

I made a build script which will copy all the files I want from WebContent to WebContentBuilt. It also runs the dojo build, again putting the built files into WebContentBuilt. I copy almost everything over. Then, I change the deployment assembly in eclipse(right click the project > properties > deployment assembly). I remove the entry that deploys WebContent to / and add an entry for WebContentBuilt. Now, tomcat will serve the files from that directory. Also, if you export a war file right now, it will export the built files. When you're done and want to go back to your development setup, just reverse what you did to your deployment assembly.

Basically, I have two document roots, one for unbuilt, and one for built, and I just point the webserver at whichever one I want.

I never put the built stuff in source control. In fact, I ignore the entire WebContentBuilt.

I have no idea how to pull this off without keeping a copy of dojo in each project though. I've successfully shared java files across multiple projects by putting the common project on the eclipse build path, and having the common projects export certain things, but I've never tried this with client side files that go in the WebContent folder.

note- after you change the deployment assembly, tomcat has to "republish". This takes a really long time because dojo has so many friggin files. So, in summary, this works decent except that I have to manually change some ide settings to get into my pseudo production mode so I can do a build, and this takes a long time. But, I do a build very infrequently, so its not so bad.

If you're using Subversion, you could use svn:externals to reference the common files in both projects. Then you can edit the common files in one place, and if you do a svn up all will be synchronized.

How do I keep Dojo development productive and still deploy using Dojo Build?

all you do is structure a profile.js file for your application and then run the to build it... you get a minified image in the end, and put it in your page... you can define as many separate packages as you want. and all this can be integrated with your loadbuild process.

i'd suggest going through the steps in a couple of references, it'll take a short while; i don't have a short answer to your question.

references for you:

  • creating builds - dojo
  • scaffolding a dojo application - this is a pre-amd blog post, but step-6 onwards is relevant for you.