I recently migrated a web project that was using
MyEclipse to using
Eclipse WTP. It was actually quite simple. This assumes you have Eclipse 3.1 and WTP 0.7 installed (WTP also requires EMF and GEF to be installed). I started by
creating a web project using WTP's template (create a new "Dynamic Web Project"). Then I inspected the files it created and applied the differences to my existing MyEclipse-based project.
The web project I created with WTP was called "webproject". So when you see "webproject" in the following files, that is the project name. The project layout looks like this:
/webproject
/JavaSource - source code directory
/.deployables - automatically generated files that are to be deployed
/webproject
/WebContent - web content files
.classpath - Eclipse classpath config
.project - Eclipse project config
.wtpmodules - WTP config
In my MyEclipse-created project, "JavaSource" is "src", and "WebContent" is "WebRoot".
I opened up Navigator view to get a better of view of the files involved.
Lets look at the .classpath created, parts that need to change are bolded:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/j2sdk1.5-sun"/>
<classpathentry kind="con"
path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v5.5"/>
<classpathentry output=".deployables/webproject/WEB-INF/classes" kind="src" path="JavaSource"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container/webproject"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Note the "bin" directory that is configured as an output directory. I left that as is. I replaced my entire .classpath file with this version. Most of my jar files are in WEB-INF/lib which WTP automatically adds to classpath, so the references to those jar files were not included in .classpath (you get an error if you do). There were some jar files that are not deployed that I included in .classpath, though.
I took the .project file from the WTP and replaced my MyEclipse .project with it, changing only the project name.
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>webproject</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.modulecore.ComponentStructuralBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.modulecore.ComponentStructuralBuilderDependencyResolver</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.modulecore.DependencyGraphBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
</natures>
</projectDescription>
Then I copied over the .wtpmodules file to the root of my project:
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId">
<wb-module deploy-name="webproject">
<module-type module-type-id="jst.web">
<version>2.4</version>
<property name="context-root" value="webproject"/>
<property name="java-output-path" value="/bin/"/>
</module-type>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/JavaSource"/>
<wb-resource deploy-path="/" source-path="/WebContent"/>
</wb-module>
</project-modules>
I deleted the WebRoot/WEB-INF/classes directory that used to be an output directory. I closed and opened the project, did a Project->Clean which triggered a rebuild of the project. Then I switched to J2EE perspective and configured a Tomcat 5.5 instance for my project, started it up, browsed to URL that it normally is at, and everything worked. The .deployables directory was created automatically and I did not have to create it.
With the MyEclipse project, I was able to set it up such that I could work on the project in Eclipse without MyEclipse installed (just had to use Ant to build deployables). However, I'm not sure that it will work with this setup (Eclipse without WTP), since the classpath doesn't have the jar files and they are probably not automatically included if WTP is not installed.
Comments
I'm making the switch right
I'm making the switch right now. MyEclipse has become far to unstable for me (OS X) and is generally a gigantic memory hog (for me and my development team on OS X and Windows XP). I've used WPT for my personal projects and it's worked out well so I've decided to ditch MyEclipse at work as well. If the MyEclipse group ever decided to return to their roots and streamline their existing functionality, I may revisit it. But until now the overhead just isn't worth it.
But why?
Hi there
What were the reasons for migration?
WTP does everything I need,
WTP does everything I need, its free, and I wanted to spend some time evaluating it on a personal project (I still use MyEclipse at work). I'm still using WTP 0.7 for that project, but have found it to be buggy sometimes. I'm thinking of switching back to MyEclipse, but I will try the latest versions of WTP that were released with Callisto first. I actually do like the way managing app servers works in WTP better than MyEclipse, though, so if the latest WTP doesn't have the same issues I've encountered I will stick with it.