Eclipse Generic Projects

How to create generic projects in Eclipse, so that you are not tied down to project structure, and eclipe's publishing tool.

Author: Ivar Abrahamsen
License: flurdy's license of respect (CC by).

In development

Last update: 2005


| More

Note: This document is now quite outdated, its a long time since I instead switched to Maven and project layout by convention.

| Introduction | Install | Notes |

Introduction

This document came about with my own need to have a slightly different project set up than the default Eclipse WTP one.

I like the integration of Tomcat in Eclipse, But I could not get the grips with which folders was published and which not. Coming from a Netbeans background, where the Ant integration seemed better, I grew frustrated quickly.

Even as Eclipse is very configurable and flexible, in certain areas it was not intuative to my needs. So this is a quick way to get Eclipse to follow you Ant scripts on which folder goes where etc.

top

Install

Pre-requiresite is a working Eclipse Web Tools set up. Follow my How to install Eclipse in Ubuntu if needed. I will assume the setup is as in my install, so take care if not.

Secondly this relies on Ant, so either use within eclipse or install Ant, e.g. via Ubuntu's apt-get.

Also this document will show how to publish to Tomcat. If you use another server, eg. Jboss etc, please make appropiate changes.

top

Configure Tomcat

		create tomcat profile in window/prefernces/servers
		create tomcat instance 		
		open in project explorer /servers/tomcat
		sync
		modify ports 8180,8109,8105
		sync
		create manager user in tomcat-users.xml
		sync
		create ds if needed in server.xml
		sync		
		check if files exist  and published to .metadata/.plugins/org.eclipse.wst.server.core/tmp0/
		create Catalina/localhost folder in .metadata/.plugins/org.eclipse.wst.server.core/tmp0/conf
		copy manager.xml from downloaded /opt/tomcat
		sync
		start tomcat
		

top

Create Project

		Create Dynamic Project
		choose project name (rem eclipse wont ever allow another project 
			by the same name, even after you closed and deleted it, so choose carefully)
		if not ok change directory
		runtime is tomcat
		config is custom
		click next
		dynamic and java should be ticked
		contextroot as you desire, eg project name if no spaces
		content directory: i prefer web
		click finish
		

top

Project Structure

			the whole point of this is to be generic so amend to your needs.
			here is my structure
			like 
				https://svn.flurdy.com/code/java/passhash/trunk/
				http://svn.sourceforge.net/viewcvs.cgi/wishlist/app/trunk/
				
			root
				build.xml
				build				
				conf
				dist
				lib
				src
				web	
			
			symlink web.xml and lib
			
		

top

Subversion

			ignore eclise files such as .settings .classpath .project
			and ignore local settings so that your pw and local paths are not shared.
			hence my -examples files instead
		

top

Libs

			Tell eclipse about your libs.
			right click project and click on java build path
			click libraries and click add jar (remeember to have refereshed you structure
			click on your project, add all jars in you lib folder.
		

top

Ant Targets

			run/external tools/external tools ( or slow click on external tools icon on toolbar and choose external tools)
			right click  on ant build, choose new
			create name depending on what it is to do, eg clean, deploy, redeploy, eg passhash redeploy
			browse workspace to choose your build.xml and build directory
			under target tab, tick sort, then choose desired targets. eg for redeploy i got redeploy and reload.
			under common you can tick if this one is to be a favourite. my redeploys usually are as they are used a lot.
			i often only create the redeploy in eclipse and then use command line to do list and initial deploy
			otherwise the external tools list becomes very long when you 10 projects or more
		

top

Ant

			redeploy locally is done without using wars for speed, just simple file copy where canged.
			howerver test- and live- copy the whole war to its target, so if offsite to consider the file size if upload
			speed is restrictive.
		

top

Alternatives

			Setting ant target as a build company in project builders section.
		

top

		

top

		

top

Notes

Creative Commons License The license text itself is licensed under
a Creative Commons Attribution 2.0 England & Wales License.