Friday, July 22, 2016

Maven ServiceBuilder stop override portlet-model-hints.xml with lifeary

Hello Liferay Experts,

Here i am sharing some important liferay + maven information. which i got after spending my more then half day, it may help you as well.

This is helpful for those who are working with liferay 6.1 + service builder  + maven build tool. some time you need to change DB field size rather then default size which generate from service builder code.

Obviously liferay expert very well know to change  portlet-model-hints.xml  to increase filed size. if you don't know about that then this is importance for you, you need to change that file. it's famous and well known problem with maven is overriding your portlet-model-hints.xml everytime while you build service. please check MAVEN-37 and LPS-10607 links for reporting @ liferay.

Due to this you want be able to change your filed size because if you change that file and getting that reflect you need service build. as i said earlier service build is again override your changes if you do build service. to overcome/resolve this issue here i come up with workaround and few step to follow....

1.  Your maven portlet parent pom.xml configure the liferay maven plugin for version 6.1.30 like              bellow...
    <build>
<plugins>
<plugin>
                       <groupId>com.liferay.maven.plugins</groupId>
             <artifactId>liferay-maven-plugin</artifactId>
             <version>6.1.30</version>
             .....

        </plugin>
     </plugins>
   </build>

2. Maven portlet parent pom.xml also have entry in dependency for above liferay maven plugin.

     <dependencies>
<dependency>
   <groupId>com.liferay.maven.plugins</groupId>
   <artifactId>liferay-maven-plugin</artifactId>
   <version>6.1.30</version>
</dependency>
</dependencies>


3. Make sure maven porlet all three pom.xml refer the same configuration version of liferay maven     plugin. suppose you have maven portlet name portlet-test then check below files

    -porlet-test/pom.xml
    -porlet-test/portlet-test-porlet/pom.xml 
    -porlet-test/portlet-test-portlet-service/pom.xml

4. Update portlet-model-hints.xml with your required changes something like

    <field name="message" type="String">
<hint-collection name="TEXTAREA" />
    </field>

5. Rebuild service.xml and deploy porlet then check your DB table wether your changes get reflect or     not. i am sure yes it is.

6. Make smiley face.....


Hope this save someone development time and make them relax...!!

Thank you.

NOTE : 
I am working with maven 6.1.2 and liferay 6.1.2 and above solution is perfectly working fine with mentioned version.


Thanks,
Ketan Savaliya


No comments:

Post a Comment