This article is a troubleshooting guide to assist with common errors in using Liferay Maven SDK. The information listed below is applicable to all Liferay Portal versions.
Resolution
When encountering issues with Maven, it is important to verify that Maven has been installed correctly as well as the Liferay Artifacts. If everything appears to be installed and setup correctly, you may wish to check and see if the project will compile in the Liferay SDK or Liferay Developer Studio. Additionally, do not forget to visit the Apache Maven Project site for any Maven specific issues.
Verify installation
1. Please run the following command: mvn --version
You should receive a similar output:
C:\>mvn --version Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 05:51:28-0800) Maven home: C:\apache-maven-3.0.5\bin\.. Java version: 1.6.0_39, vendor: Sun Microsystems Inc. Java home: C:\Program Files\Java\jdk1.6.0_39\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
2. If you receive an Out of Memory error, add a MAVEN_OPTS environment variable and set it to the following values: -Xmx512m -XX:MaxPermSize=128m
3. Verify the Liferay Artifacts are not corrupted by running the 'ant install' command on the Liferay/Maven artifacts.
Verify Setups
1. If you are using a remote repository, verify that the artifacts have been installed and are not corrupted.
Ensure that the settings.xml file (located in ${USER_HOME}/.m2/) has appropriate values for the following settings:
<?xml version="1.0"?> ... <settings> ... <servers> <server> <id>liferay-releases</id> <username>admin</username> <password>admin123</password> </server> <server> <id>liferay-snapshots</id> <username>admin</username> <password>admin123</password> </server> ... </servers> ... </settings>
Ensure that the build.[user name].properties file (located in the directory of your Liferay/Maven artifacts) has appropriate values for these properties:
lp.maven.repository.id=liferay-releases
lp.maven.repository.url=
- http://localhost:8081/nexus/content/repositories/liferay-releases
In the directory of your Liferay/Maven artifacts, run the following command: ant deploy
If you receive errors, verify that the repository information is correct.
2. Verify that your pom.xml has the appropriate values for your project (portal version, deploy directory, dependencies, etc.)
3. Verify that the following property in your project's pom.xml has the correct archetype for the project you are developing:
<build> <plugins> <plugin> ... <configuration> ... <pluginType>portlet</pluginType>
If the wrong type is listed, create a new project using 'mvn archetype:generate' and choose the correct archetype, then transfer your code over.
Additional Information
If everything is installed and configured correctly, you may wish to see if the project builds with our SDK or Liferay Developer Studio. Please note that the project directory hierarchy is different between Maven and the Liferay SDK, and you can view the differences by reading Liferay Plugin Types to Develop With Maven. This linked User Guide documentation is for Liferay Portal 6.1, but the Maven Troubleshooting Guide pertains to all Liferay Portal versions.