intechops6
intechops6

Reputation: 1097

Liferay maven service builder fails

Liferay says to keep the service and portlet under the same directory and maven build refers service.xml from the service directory. As per release management standard, I have to keep the service.jar in the separate repository and portlet in another repository.

I copied the pom.xml and service.xml in the same root directory and mvn compile generates the class files for the source files but Liferay service compile fails with NULLpointerException. How to compile the liferay service builder separately. I am using Liferay v6.2.

mvn clean install liferay:build-service 

The pom.xml is available at https://github.com/get2arun/logs/blob/master/pom.xml

The below is the error:

[ERROR] Failed to execute goal com.liferay.maven.plugins:liferay-maven-plugin:6.2.10.15:build-service (default-cli) on project project-business-user-api: null: MojoExecutionException: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.liferay.maven.plugins:liferay-maven-plugin:6.2.10.15:build-service (default-cli) on project project-business-user-api: null
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)

Upvotes: 0

Views: 876

Answers (1)

Peter Petrekanics
Peter Petrekanics

Reputation: 181

I managed to work around that error by following the steps below. I have just finished testing now. At the end I was able to create a Liferay Plugin Project that contains a Liferay MVC Portlet and a Liferay Service Builder, and upon deployment the Foo_Foo table was successfully created.

Please find the detailed steps below:

  1. I downloaded the Liferay version of Eclipse: liferay-ide-eclipse-linux-x64-2.1.0-ga1-201403281241.tar.gz using this IDE is not mandatory, but if you use it, then you need to use this specific version (LDS 2.2.2 GA3 and LDS 2.0.0-ga1 could not create a maven Liferay Plugin Project today)
  2. I installed this Liferay SDK inside the IDE: liferay-plugins-sdk-6.2-ee-sp5-20140606104845789.zip
  3. As the runtime environment, I used: liferay-portal-tomcat-6.2.0-ce-ga1-20131101192857659.zip
  4. Inside the IDE, I changed the Java runtime to jdk1.7.0_80 (Eclipse - window - preferences - installed JREs)
  5. I created a new project in the IDE: File - new - Liferay Plugin Project, maven, selected my Maven global profile (settings.xml), Plugin type = Portlet It is important to note that my settings.xml file contains these values:

    < liferay.maven.plugin.version>6.2.5< /liferay.maven.plugin.version>
    < liferay.version>6.2.5< /liferay.version>

(choosing higher versions resulted in .jar not found errors).

  1. I right-clicked the project and created a new Liferay Portlet
  2. I copied the service.xml into the {Project-Home}/src/main/webapp/WEB-INF directory (One thing to note: the package-path in the service.xml has to be different than the Portlet's package name.)
  3. Inside the IDE, I right-clicked the project and choose: Liferay -> Build Services but I believe the command you used works also fine
  4. I deployed the portlet and indeed the new db table was created.

I was using Ubuntu 18.04 + Apache Maven 3.6.0 + blade version 3.7.3.201906241529 I have shared the Project on: https://github.com/peterpetrekanics/Liferay_ServiceBuilder_Maven_6210CE

I hope this helps,

Kind Regards,

Peter

Upvotes: 1

Related Questions