Foros de discusión

Service Builder Liferay 7

Pranav Parmar, modificado hace 7 años.

Service Builder Liferay 7

New Member Mensajes: 10 Fecha de incorporación: 27/07/16 Mensajes recientes
how to build service in serviice builder in liferay 7 ?
when i run command ./gradlew buildService under root directory , following error appears :
* What went wrong:
Task 'deploy' not found in root project 'portletServiceBuildDemo'.
* Exception is:
org.gradle.execution.TaskSelectionException: Task 'deploy' not found in root project 'portletServiceBuildDemo'.
thumbnail
David H Nebinger, modificado hace 7 años.

RE: Service Builder Liferay 7

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
You have to buildService in the module that has the service.xml file.





Come meet me at the NAS!
Pranav Parmar, modificado hace 7 años.

RE: Service Builder Liferay 7

New Member Mensajes: 10 Fecha de incorporación: 27/07/16 Mensajes recientes
when I run buildeService command under service.xml's directory it gives following error


FAILURE: Build failed with an exception.

* What went wrong:
Task 'buildService' not found in root project 'portletServiceBuildDemo'.

* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
thumbnail
David H Nebinger, modificado hace 7 años.

RE: Service Builder Liferay 7

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
I'm guessing you have a build.gradle problem, likely missing the buildscript dependency. Can you share the build.gradle file in the directory w/ the service.xml file?





Come meet me at the NAS!
Pranav Parmar, modificado hace 7 años.

RE: Service Builder Liferay 7

New Member Mensajes: 10 Fecha de incorporación: 27/07/16 Mensajes recientes
Well first , thanx David for providing such efficient solutions .

Now I managed to solve that problem, but there is another problem.My MVC Portlet's build.gradle is as follows:
dependencies {

compile group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
compile group: "javax.portlet", name: "portlet-api", version: "2.0"
compile group: "javax.servlet", name: "servlet-api", version: "2.5"
compile group: "org.osgi", name: "org.osgi.compendium", version: "5.0.0"
compile project(":modules:my-sb:my-sb-api")
}

and service builder's build.gradle is as follow:

buildscript {
dependencies {
classpath group: "com.liferay", name: "com.liferay.gradle.plugins.service.builder", version: "latest.release"
}

repositories {
mavenLocal()

maven {
url "http://cdn.repository.liferay.com/nexus/content/groups/public"
}
}
}
dependencies {
compile group: "biz.aQute.bnd", name: "biz.aQute.bndlib", version: "3.1.0"
compile group: "com.liferay", name: "com.liferay.portal.spring.extender", version: "2.0.0"
compile group: "com.liferay", name: "com.liferay.osgi.util", version: "3.0.0"
compile project(":modules:my-sb:my-sb-api")
}

buildService {
apiDir = "../my-sb-api/src/main/java"
osgiModule = true
propsUtil = "com.st.service.util.PropsUtil"
}

When I try to build my portlet and service I get following error :

modules:employee-mvc-portlet:checkSourceFormatting
./build.gradle
./src/main/resources/META-INF/resources/init.jsp
./build/resources/main/META-INF/resources/init.jsp
./bin/META-INF/resources/init.jsp
Exception in thread "main" com.liferay.source.formatter.SourceMismatchException
at com.liferay.source.formatter.BaseSourceProcessor.processFormattedFile(BaseSourceProcessor.java:2488)
at com.liferay.source.formatter.BaseSourceProcessor.format(BaseSourceProcessor.java:1024)
at com.liferay.source.formatter.BaseSourceProcessor$1.call(BaseSourceProcessor.java:106)
at com.liferay.source.formatter.BaseSourceProcessor$1.call(BaseSourceProcessor.java:101)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
:modules:employee-mvc-portlet:checkSourceFormatting FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':modules:employee-mvc-portlet:checkSourceFormatting'.
> Process 'command '/usr/lib/jvm/java-8-oracle/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED
thumbnail
David H Nebinger, modificado hace 7 años.

RE: Service Builder Liferay 7

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
I've been bit recently by this one too. Liferay has added a requirement their source formatting rules to all projects using the Liferay gradle tools.

The failure you're getting is because your code does not follow Liferay's formatting rules.

You have two options:

  • Run "gradle formatSource" to apply Liferay formatting rules to your code (note it does not handle every situation perfectly and you may need to edit your code to make it conform to Liferay rules).
  • Add "-x checkSourceFormatting" to disable the checkSourceFormatting task during builds.







Come meet me at the NAS!