Cleaning up after yourself -- Deleting test extensions
By John 'Jb' Brock-Oracle on Sep 09, 2011
When developing extensions, you often need to run the extension to test something, then make some changes, and run it again. Often many times in a row. If you're like me, you use the "Run Extension" option in the IDE a lot.
I'm constantly checking menu placements, and dialog look and feel, etc.
while I'm developing the extension. Sometimes you run into issues where it just doesn't seem like the new changes are taking effect and you want to clean up the old extension files and start with a fresh environment.
NOTE: These steps are for when you are doing a lot of start and stop testing. You should not need to do this all of the time. Nor should you have to leave the caching setting, mentioned below, in place for normal development.
While JDeveloper does not officially support the uninstall of extensions (you can setup your extension to be disabled), there are ways to delete the extension while doing development so you aren't running into potential caching issues or just running into older versions of the jar files.
Cleaning things up
If you are doing everything in one jar file, it's really simple to clean things up and make sure you are not running into an older version of your extension. If your extensions is more complex, you will need to know what artifacts your extension is putting in what places, in order to clean them up.
One of the fastest ways to see what is being deployed, is to click on the "Deploy to Target Platform" in the context menu for your project.
This will open a Deployment Log window and you can see everything that is being deployed and to which locations.
Working with 11gR1
Once you know the location and name of the artifacts, close JDeveloper and open your favorite file manager to delete those files and/or directories. After the files have been deleted, start JDeveloper back up.
Working with 11gR2
If you are working with the latest version of 11gR2, you will need to do the step above as well as a couple more steps to make sure you are not running into some potential caching issues.
First, when you add an extension via the Check for Updates feature in JDeveloper, information about that extension is added to an info file. This file is located at: <mw_home>/jdeveloper/configuration/cfu_bundles.info. You will need to open this file in a text editor and remove the lines that pertain to your extension. Be very careful that you don't remove lines that may be related to someone else's extension or an extension that you still want loaded.
Second, when you right-click on the project and select "Run Extension" the IDE uses the default Run configuration for the project to startup the new IDE instance. To avoid potential caching issues when you are testing your extension, you will want to add a program argument to the default run configuration.
Double-click on the project name in the navigator and it will open the Project Properties dialog. Select the Run/Debug/Profile option at the bottom left of the dialog
The Default run configuration should be selected, and you can just click on Edit to open it.
Look for the Program Arguments field and enter " -clean " in the field. With this argument you will have all of the caching cleared each time you use the Run Extension feature. It does not remove any files or data. It just cleans up the cache so that you are loading new versions of the extension libraries each time the command is run.
This is not something that you want to add to the actual IDE startup command, or have in place all of the time as it can remove some of the performance benefits that are new in 11gR2.
These couple of steps can save a lot of frustration at times. I hope it helps others while doing the testing of your extensions. I did mention above that you can setup your extensions to allow the end-user to disable them at runtime. If you are interested in how to do that, please let a comment and if enough people are interested, I'll put up a separate post on how to do that in both R1 and R2.
As usual, comments are always welcome and encouraged!