How to undeploy Liferay 6 EE Ext Plugin

Liferay EE 6 has done away with the old EXT environment in previous versions and has moved to a more extensible plugin approach.  While I wholeheartedly endorse that approach, it is fraught with one small problem: redeployments.  The situation is this: you initially deploy your EXT plugin but then you make some changes and want to redeploy.  Well your previous deployment’s jars are now in the class loader so you can’t just run “ant deploy” again to get your new changes on the server.

The solution: shutdown your server and run this script.  This script has been improved upon from this post here to include portlets that you may have modified in your EXT.  I’ve also included a version for MAC/Linux users.

Windows Version:

@echo off
set app_name=%1
if "%app_name%" == "" goto end
set tomcat_home=C:\apps\liferay-portal-6.0-ee\tomcat-6.0.29

rmdir /S /Q %tomcat_home%\temp
rmdir /S /Q %tomcat_home%\webapps\%app_name%-ext
rmdir /S /Q %tomcat_home%\webapps\ROOT\html\portlet\ext
del /S /Q %tomcat_home%\lib\ext\ext-%app_name%-ext-service.jar
del /S /Q %tomcat_home%\webapps\ROOT\WEB-INF\lib\ext-%app_name%-ext-util-bridges.jar
del /S /Q %tomcat_home%\webapps\ROOT\WEB-INF\lib\ext-%app_name%-ext-util-taglib.jar
del /S /Q %tomcat_home%\webapps\ROOT\WEB-INF\lib\ext-%app_name%-ext-util-java.jar
del /S /Q %tomcat_home%\webapps\ROOT\WEB-INF\lib\ext-%app_name%-ext-impl.jar
del /S /Q %tomcat_home%\webapps\ROOT\WEB-INF\ext-%app_name%-ext.xml
del /S /Q %tomcat_home%\webapps\ROOT\WEB-INF\tiles-defs-ext.xml
del /S /Q %tomcat_home%\temp\liferay\com\liferay\portal\deploy\dependencies\ext-%app_name%-ext-util-bridges.jar
del /S /Q %tomcat_home%\temp\liferay\com\liferay\portal\deploy\dependencies\ext-%app_name%-ext-util-taglib.jar
del /S /Q %tomcat_home%\temp\liferay\com\liferay\portal\deploy\dependencies\ext-%app_name%-ext-util-java.jar
:end

Mac/Linux Version:

#!/bin/sh

if [ $# -ne 1 ]; then
 echo "Usage: clean-my-ext [ext-name]"
 exit 1
fi

tomcat_home="/local/mnt/apps/liferay/tomcat-6.0.29"
app_name="$1"

rm -rf $tomcat_home/temp
rm -rf $tomcat_home/webapps/$app_name-ext
rm -rf $tomcat_home/webapps/ROOT/html/portlet/ext
rm -f $tomcat_home/lib/ext/ext-$app_name-ext-service.jar
rm -f $tomcat_home/webapps/ROOT/WEB-INF/lib/ext-$app_name-ext-util-bridges.jar
rm -f $tomcat_home/webapps/ROOT/WEB-INF/lib/ext-$app_name-ext-util-taglib.jar
rm -f $tomcat_home/webapps/ROOT/WEB-INF/lib/ext-$app_name-ext-util-java.jar
rm -f $tomcat_home/webapps/ROOT/WEB-INF/lib/ext-$app_name-ext-impl.jar
rm -f $tomcat_home/webapps/ROOT/WEB-INF/ext-$app_name-ext.xml
rm -f $tomcat_home/webapps/ROOT/WEB-INF/tiles-defs-ext.xml
rm -f $tomcat_home/temp/liferay/com/liferay/portal/deploy/dependencies/ext-$app_name-ext-util-bridges.jar
rm -f $tomcat_home/temp/liferay/com/liferay/portal/deploy/dependencies/ext-$app_name-ext-util-taglib.jar
rm -f $tomcat_home/temp/liferay/com/liferay/portal/deploy/dependencies/ext-$app_name-ext-util-java.jar
Advertisements

3 comments on “How to undeploy Liferay 6 EE Ext Plugin

  1. I hoped your method would work… unfortunately it can never cope with removing an ext plugin which adds to Liferay’s web.xml or deploys extra jars to the boot classpath – the only ‘safe’ way seems to be using the sdk’s ant tasks to clean the environment.

  2. Pingback: How do I undeploy a Liferay Portal 6 EXT Plugin - Blogs - Permeance Technologies

  3. Pingback: How do I undeploy a Liferay Portal 6 EXT Plugin - Home - Permeance

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