Blog Post

...

Liferay 7 alpha/beta ServiceBuilder

Hey, we are all watching with great interest to the first coming stable Liferay 7 release (link). By now alpha and even beta releases are available for testing, they include new cool features and improvements. But still some old functionality is not migrated to the new releases. In this post I’ll talk about ServiceBuilder which is still not officially published and is missing in current alphas and betas. Anyway it is possible to find and use Liferay 7 ServiceBuilder (in liferay-ce repository). In this post I’ll show how to do it.

As said above, ServiceBuilder is missing in current Liferay 7 alpha and beta releases, you won’t find it in corresponding SDKs / Tomcat / Artifact bundles on official downloads page (link). But anyway this feature of Liferay is important and can greatly ease our lives when we need to generate a bunch of Java (and other) files from a single service.xml.

Assume that we have a default pom.xml configuration. Up-to-date Liferay 7 ServiceBuilder can be found in this Maven repository:

<repositories>
    <repository>
        <id>liferay-ce</id>
        <url>https://repository.liferay.com/nexus/content/groups/liferay-ce/</url>
    </repository>
</repositories> 

And the Maven plugin that includes ServiceBuilder has the following id and configuration, that should be added to the build->plugins section of your pom.xml:

<plugin>
    <groupId>com.liferay</groupId>
    <artifactId>com.liferay.portal.tools.service.builder</artifactId>
    <version>1.0.67</version>
    <configuration>
        <apiDirName>../blade.servicebuilder.api/src/main/java</apiDirName>
        <beanLocatorUtil>com.liferay.util.bean.PortletBeanLocatorUtil</beanLocatorUtil>
        <hbmFileName>src/main/resources/META-INF/module-hbm.xml</hbmFileName>
        <implDirName>src/main/java</implDirName>
        <inputFileName>service.xml</inputFileName>
        <modelHintsFileName>src/main/resources/META-INF/portlet-model-hints.xml</modelHintsFileName>
        <osgiModule>true</osgiModule>
        <propsUtil>blade.servicebuilder.service.util.PropsUtil</propsUtil>
        <resourcesDirName>src/main/resources</resourcesDirName>
        <springFileName>src/main/resources/META-INF/spring/module-spring.xml</springFileName>
        <springNamespaces>beans,osgi</springNamespaces>
        <sqlDirName>src/main/resources/META-INF/sql</sqlDirName>
        <sqlFileName>tables.sql</sqlFileName>
        <testDirName>src/test</testDirName>
    </configuration>
</plugin>

Configuration section parameters are pretty straightforward if you had an experience in Liferay 6 or earlier. Now our pom is ready to build/generate service files, so just run in terminal:

 

mvn liferay:build-service

Comments (0)

Tags: liferay


0 comments

Leave a Comment