The intent of this post is to clear up some foggy notions and misconceptions about the Elastic Path 6.1 development environment, as well as provide a few insider tips and tricks. Developers of CM Client modules will probably find the following more helpful than web or core application developers, but the principles can be used by everyone.
If you're doing any development of the CM Client and you make a change to EP Core, and you want that change to be available in the CM Client, your typical build time shouldn't be more than a minute or so, hopefully much less. Let's clarify:
When you're running the CM Client from within Eclipse, the CM Client will not use the CORE jar; it will use the CORE project's class files directly. This means that you do NOT have to run "ant all" on the command line (I never run it - it takes forever).
Let's look at a typical day of developing some new feature in the CM Client where you might be changing some code in the EP Core project. If (and only if) you have changed any persistent classes in the core (i.e. domain objects), you have to make sure that JPA has "enhanced" these classes before you can use them, right? So you have two choices (maybe more, but these are the two that I see):
- run "ant enhance" in the com.elasticpath.core project and refresh the project in eclipse. This ensures that JPA has a chance to modify the class files that eclipse's compiler created and then eclipse doesn't think its knowledge of the class files is out-of-date. This takes a few seconds.
- run "ant build" in one of the web projects (e.g. com.elasticpath.cm), which will rebuild the core project, enhance its class files, and refresh the core jar file that the webapp will use if you're running it outside of eclipse (which most of us don't do anyway - we run it with WTP inside eclipse, so once again the project files are used rather than the core jar file). This takes about 15 seconds on my box (unless maven connections are having problems, but that's a separate issue).
So in a typical developer environment for EP 6.1, using WTP to run the webapps, the CORE jar is never actually used. So it doesn't have to be built, and it certainly doesn't have to be copied anywhere for the CM Client to use it.
Now for some caveats:
- If you have previously built the CM Client on the command-line (ant all, ant build-product, etc) you will likely see that it has created a jar file for each plugin in each of the plugin directories. You must delete these or you will find that changes to the code for that plugin are not reflected in the running copy (if it finds a jar, it will use that jar instead of your project code).
- The com.elasticpath.ql project seems to be referenced as a jar file from the com.elasticpath.cmclient.libs project. You must build this project once on the commandline so that its jar is created; otherwise you'll find that running the CM Client won't work because the Spring initializer is expecting some code that it cannot find. This often catches developers who have just imported all their eclipse projects and they try to run the CM Client. If you're developing on this ql project you likely already know this; if you're not, then you only have to do this once and you can forget about it.
- When setting up a new workspace, you *do* have to do an "ant eclipse-setup" once in the com.elasticpath.cmclient directory to make sure that all the CM Client plugins have eclipse project files generated for them, which you can import into eclipse. The list of projects for which project files will be generated lives in the build.xml file in that directory. If you're adding a new plugin, you will need to add it to that list so that its project file is generated properly (with maven information, etc).
- Each Web project requires a META-INF/context.xml file for you to be able to run it in tomcat with WTP. This file is generated by the eclipse-setup script if you've got tomcat specified in your env.config file when you run the script, but I believe it's wiped out when you run "ant clean"... so don't run that, or if you do then make sure you run ant eclipse-setup again.