Total Pageviews

Sunday, August 26, 2012

Automated Undeployment of Liferay EXT

Those who work with Light Weight EXT environment very well know that its redeployment is a bit tricky because it needs its undeployment correctly. I've already written an article for its manual undeployment (see article), but during development it takes good time and efforts, so I thought to get some automated way to get it done and the solution I got is using ANT. There the three variation with change only in invocation method. Lets see it:

NOTE: In all examples, name of ext is considered as : example-ext, and following scripts are to added in build.xml file inside the ext folder of sdk. We need to shutdown the server, run this target, start the server and deploy ext again.

1. EXT context name is hardcoded inside ANT script.

Now this can be invoked, as the following:

2. Secondly, we all make the "build.${}.properties" (eg.") in which we generally set app.server.dir property with path of our web server path. We can create a new property in the same file with the name of ext instead of hard coding the name of ext in ant script, so that it will become a bit of configurable. Advantage of this approach is - as we are allowed to have only one ext in a project and while we create the custom build properties file, we can put the name of the ext in that file along with the name custom property. So the custom build file will look as the following:
Now we need to make some minor changes in ANT script, which will look as following:
We can call the target simply as following:

3. Lastly, we can pass name of the ext on the command prompt to make the approach more flexible. If we invoke the ANT script written above as follows, it will supply the name from the command line:
The point to remember is that, don't make the property in the custom build property file.

Hope this will help.

No comments:

Post a Comment