RE: Fast Deploy with Ant for Development

8033784, modified 15 Years ago. Junior Member Posts: 91 Join Date: 3/28/11 Recent Posts
I'm trying to make a "fast deploy" for development with ANT. I want to compile the controllers and the ServiceImpl classes (the classes that we change often) and update those in the webapp/web-inf/classes directory.

I'm able to compile and copy the files ".class" in the /web-inf/classes directory, but the portal doesn't seem to be aware that the .class changed... Is Liferay or Tomcat loading the .class in memory and not looking on the file system to see if they changed? Is there something I can do about it?

Thank you!
5376263, modified 15 Years ago. Junior Member Posts: 84 Join Date: 7/21/10 Recent Posts
Try copying files in \liferay-portal-tomcat-6.0.5\deploy directory. I am very sure liferay will pickup files first time. Not sure whether it will use hot deploy to use updated class files.
thumbnail
4753419, modified 15 Years ago. Liferay Legend Posts: 7942 Join Date: 3/24/10 Recent Posts
Try copying files in \liferay-portal-tomcat-6.0.5\deploy directory. I am very sure liferay will pickup files first time. Not sure whether it will use hot deploy to use updated class files.


Just wondering if Liferay would know which war directory to deploy the class file to.
thumbnail
4753419, modified 15 Years ago. Liferay Legend Posts: 7942 Join Date: 3/24/10 Recent Posts
I'm able to compile and copy the files ".class" in the /web-inf/classes directory, but the portal doesn't seem to be aware that the .class changed... Is Liferay or Tomcat loading the .class in memory and not looking on the file system to see if they changed? Is there something I can do about it?


I think most class files and configuration files are loaded when the portlet is loaded.
8033784, modified 15 Years ago. Junior Member Posts: 91 Join Date: 3/28/11 Recent Posts
I tried adding "reloadable=true" to the context.xml file (inside webapps\application_dir\meta-inf\context.xml

And when I start in debug mode, I get the
"Root context attribute is not of type WebApplicationContext" error. Maybe it has something to do with Spring MVC too, I don't know.

When I start in normal mode, the webapp starts but the changes aren't applied anyway. emoticon
8033784, modified 15 Years ago. Junior Member Posts: 91 Join Date: 3/28/11 Recent Posts
I just found that page
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Fast+Development+of+Liferay+Plugins+with+Tomcat

I'm going to try that out...
8033784, modified 15 Years ago. Junior Member Posts: 91 Join Date: 3/28/11 Recent Posts
I was unable to make it work.
If I add a "reloadable=true" in the context.xml file, spring has problems with loading some classes :

Loading file:/C:/projects/tomcat-6-liferay-6.0.5/tomcat-6.0.26/webapps/webapp-portlets/WEB-INF/classes/service.properties
11:56:35,903 ERROR [PortletApplicationContext:80] org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Class that bean class [com.company.auction.service.impl.ContractLocalServiceImpl] depends on not found
Offending resource: ServletContext resource [/WEB-INF/classes/META-INF/portlet-spring.xml]

But when I remove the "reloadable=true" everything works fine.

If I use the "webapp-name.xml" (context file) and put it in the auto deploy of liferay, I get the same problem.

If anybody was able to make it work with Liferay 6, spring MVC and tomcat, please let me know.
8033784, modified 15 Years ago. Junior Member Posts: 91 Join Date: 3/28/11 Recent Posts
Finally made it work...

First, add this line to your portal-ext.properties :
auto.deploy.tomcat.conf.dir=${catalina.base}/conf/Catalina/localhost
(thanks to mariusz in the comments of that page)

Create an xml file with this content :
<Context
path="<name-of-project>"
docBase="C:/<tomcat install dir>/webapps/<name-of-project>"
reloadable="true"
/>

The name of the file should be <name-of-project>.xml

Where name-of-project = the name of the folder in webapps dir where you webapp is deployed

Now, copy this file into liferay's autodeploy folder. If tomcat is started, liferay should copy this file to ${catalina.base}/conf/Catalina/localhost and reload its context.

After that, since reloadable is specified, you will just have to copy the .class file and Liferay will reload itself.

Of course, you can use ANT to make it easier!

Enjoy! emoticon