MyEclipse does not build class files for web project

I had an interesting situation with MyEclipse not building new class files out of changed java code. It was trying to run an old copy of my application. There are a number of things you can do to fix this. Check which one works for you…

Solution:

Try and restart using -clean and see if that helps. On Mac, you will have to select the Eclipse executable and do “Show Contents” then edit the eclipse.ini file in there and add it at the top line.
Also, remove the deployment, clean your project and re-create the deployment. If it’s still not working, clean the /.metadata/.log file and retry it and see if an exception is getting reported.

Pop open your project properties for the troubled web project, and go to MyEclipse > Web and make sure the two text fields have valid Web Root and Context Root directories set.
Then go to the Java Build Path properties node and click the “Source” tab. Now double-check that your source directory or directories are setup correctly and that your output dir is set to the correct WEB-INF/classes output dir (you can use Browse to re-select it if it’s blank).
Now go to Project menu, and select Clean. Make sure the project rebuilds completely without errors.
If you have errors, double-check them, they might be invalid library or project references, which will stop project building dead in it’s tracks.

Project layout supported in MyEclipse: (Hopefully will be more flexible in the future)

/
   +/src <– Java source code for web project (servlets, actions, forms, beans, etc.)
   +/docs <– license files, readme's, etc
     +/api <– Target for your Javadoc source generation
   +/lib <– extra libs that the web app doesn't need while running
   +/webroot <– this is the base of the webroot, this will be the root when deployed to Tomcat, etc.
     +index.jsp <– example jsp file in root
     +/images <– images for the website
     +/WEB-INF
       +/classes <– build output directory
       +/lib <– libs required for your webapp to run (i.e. struts.jar, etc.)
       +/conf <– your custom conf files that you need for your app
       +/tld <– taglibs

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s