Liferay service-builder fails to generate good code

988 views Asked by At

I am setting up Liferay (Portal 7.4.3 ga55) development environment using Intellij (with Liferay plugin) and Gradle plugin. Created a new Liferay workspace project. Next created a service builder module and executed gradle buildService task for -service module. So far so good. But when i try to run gradle build task for -service module, i receive following error in -service module

1. FooModelImpl.java : toXmlString method does not override or implement a method from a supertype

  1. FooPersistenceImpl.java : method getResult in interface FinderCache cannot be applied to given types; required: FinderPath,Object[],BasePersistence<?> found: FinderPath,Object[] reason: actual and formal argument lists differ in length

What i am doing incorrectly ?

service.xml

<?xml version="1.0"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 7.4.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_7_4_0.dtd">

<service-builder dependency-injector="ds" package-path="com.sample.core">
    <namespace>FOO</namespace>
    <entity local-service="true" name="Foo" remote-service="false" uuid="true">
        <column name="fooId" primary="true" type="long" />
        <column name="groupId" type="long" />
        <column name="companyId" type="long" />
        <column name="userId" type="long" />
        <column name="userName" type="String" />
        <column name="createDate" type="Date" />
        <column name="modifiedDate" type="Date" />
        <column name="field1" type="String" />
        <column name="field2" type="boolean" />
        <column name="field3" type="int" />
        <column name="field4" type="Date" />
        <column name="field5" type="String" />
        <order by="asc">
            <order-column name="field1" />
        </order>
    </entity>
</service-builder>

gradle.properties

liferay.workspace.modules.dir=modules
liferay.workspace.themes.dir=themes
liferay.workspace.wars.dir=modules
microsoft.translator.subscription.key= 
liferay.workspace.product=portal-7.4-ga55 
target.platform.index.sources = false 
liferay.workspace.bundle.url=https://releases-cdn.liferay.com/portal/7.4.3.55-ga55/liferay-ce-portal-tomcat-7.4.3.55-ga55-20221214100304403.tar.gz

I have tried updating liferay.workspace.product & liferay.workspace.bundle.url in gradle.properties file but no success

2

There are 2 answers

0
Sachin Goyal On BEST ANSWER

After going through LPS-166596, I updated settings.gradle file with 4.0.22 version and it worked as charms

classpath(group: "com.liferay", name: "com.liferay.gradle.plugins.workspace", version: "4.0.22")
2
Fabian Bouché On

Currently, you'll have to overwrite your build.gradle in the service module like this:

dependencies {
    compile project(":modules:foo:foo-api")

    compileOnly group: "com.liferay.portal", name: "release.dxp.api"
    
    serviceBuilder group: "com.liferay", name: "com.liferay.portal.tools.service.builder", version: "1.0.445"
    
}

buildService {
    apiDir = "../foo-api/src/main/java"
}

group = "com.liferay.samples.fbo.foo"

The reason is this: https://issues.liferay.com/browse/LPS-166596