Windchill-Eclipse : Hot Code Replace

In the previous posts Windchill-Eclipse Project Setup and Windchill Method Server Debugging we discussed the basic Windchill development setup. Now it’s time to speed up the development. In this post we are going to add “Hot Code Replace” functionality in our Windchill development environment. The is the real development nitro booster.

What is hot code replace? – Ref: eclipse.org
Hot code replace (HCR) is a debugging technique whereby the Eclipse Java debugger transmits new class files over the debugging channel to another JVM. In the case of Eclipse development, this also applies to the VM that runs the runtime workbench. The idea is that you can start a debugging session on a given runtime workbench and change a Java file in your development workbench, and the debugger will replace the code in the receiving VM while it is running. No restart is required, hence the reference to "hot".

In our Windchill development environment setup, we are going to add eclipse project workspace into Windchill classpath. So when you will start eclipse method server debugging and in between debugging mode if you modify any class, the updated class code will get execute and most importantly without class compile or method server restart.
So we saved a lot time in sysouts, class compilation and method server restart

Add hot code replace in Windchill development environment setup:

  1. Take backup of /codebase/wt.properties.xconf
  2. In /codebase/wt.properties.xconf edit "wt.java.classpath" property value to add eclipse project workspace path. In the property value you need to add your eclipse project workspace bin folder path.
e.g. My eclipse project workspace bin folder path is /opt/eclipseworkspace/Windchill/bin. Replace the directory separator by Windchill directory separator variable $(dir.sep). Now my updated path will be $(dir.sep)opt$(dir.sep)eclipseworkspace$(dir.sep)Windchill$(dir.sep)bin. Add this value in the beginning of property value with the Windchill classpath separator variable $(path.sep).
The updated property value will be like as below ($(path.sep))

Property name="wt.java.classpath" multivalued="$(path.sep)" default="$(dir.sep)opt$(dir.sep)eclipseworkspace$(dir.sep)Windchill$(dir.sep)bin$(path.sep)$(wt.home)$(dir.sep)codebase$(path.sep)$LIB(wt.webinf.lib)$(path.sep) --- and original

  1. Run xconfmanager utility to propagate the xconf value
  2. Restart method server

Note:

  1. Works in eclipse debug mode only
  2. Make sure that Project -> Build Automatically is checked (enabled)
  3. Hot code replace works effectively for method level code changes but some time fails for class level changes like adding method/variable, imports, etc

Now start Windchill development without sysouts and method server restarts. So shift the development gear and go bhuuuummmmmmmm

To know more about hot code replace visit http://wiki.eclipse.org/FAQ_What_is_hot_code_replace%3F


No comments: