« Voltar para Liferay IDE

m2e-liferay Quick Start Tutorial

Introduction #

This is a quick start tutorial for how to create new Liferay Projects using maven. In this tutorial we will be using the new 2.0 Milestone-1 release of Liferay IDE which includes all of the Eclipse maven plugins (m2e-) that you need to work with Liferay maven projects.

Requirements #

Quick Start Steps #

New Maven Project #

Setup Server

  • Launch Eclipse, go to Window-> Properties-> Server-> Runtime Environment-> Add(choose the server's version you need to use, 6.1 or 6.2, select 'Creat a new local server')-> Next(add the server's path)-> Finish

Create liferay maven portlet project

  • Go to File-> New-> Project-> Maven, choose Maven Project

  • Then Next-> Next, filter the Artifact Id and Version(the version should be as same as your server's version), choose, then Next

  • Add Group Id and Artifact Id, then Finish

Resolving POM errors #

After the create project wizard, you could see there is an error in pom.xml file. We need to fix this error.

  • Add <properties></properties> tag into pom.xml file

Save the file, then Update project

  • Right click project-> Maven-> Update Project->Choose the project-> OK
  • You will see error was gone

Check project settings #

  • Deployment Assembly Check
    • Right click project-> Properties-> Deployment Assembly
    • You will see 'Maven Dependencies' in the Source
    • If the project doesn't a maven project, it won't be there

  • Project Facets check
    • Right click project-> Properties-> Project Facets-> Liferay Plugins
    • You will see the project's Liferay archetype is selected

  • Web Project Settings check
    • Right click project-> Properties-> Web Project Settings
    • If the project is correctly created, you will see the project type is there

Working with Liferay maven project #

  • Start the Server
  • When the Server is Started, deploy the project
  • Then you will see 'MavenTest-portlet is available for use'in the Console

Create liferay maven theme project

  • After the creation, when do the step "Resolving pom errors", open pom.xml file
    • You should add these new tags into <properties></properties>

  • Save, then Update project, you will see error was gone
  • The remaining steps you can do the same like portlet project

Create liferay maven portlet-jsf project

  • After the createion, when do the step "Resolving pom errors", you need to do some changes in pom.xml file
    • Delete the version 3.1.0-rc2, use the version 3.1.1-ga2 instead of 3.1.0-rc2

  • Delete the previous <repositories></repositories> tag
    • Add new <repositories></repositories> tag

  • Add the <properties></properties> tag like portlet project
  • Save, then Update project, you will see error was gone
  • The remaining steps you can do the same like portlet project

When create maven Hook, Layout, Servicebuilder,Ext projects, you can do the same steps like portlet project.

13 Anexos
25935 Visualizações
Média (0 Votos)
A média da avaliação é 0.0 estrelas de 5.
Respostas do tópico Autor Data
Trying to set up IDE 2 Milestone so I can learn... Dave Weitzel 16 de Dezembro de 2013 20:41
Hi Dave, First I am sorry for replying you so... Vicky Wang 1 de Janeiro de 2014 19:13

Trying to set up IDE 2 Milestone so I can learn Maven. Unfortunately I am not seeing this dialogue as described. I have a new server 6.1.2 GA3 installed for his exercise/project along with SDK 6.1.1 (August 16th 2013).
following above I first do Go to File-> New-> Project-> Maven, choose Maven Project
Then I get a dialogue now show asking for location (should I be selecting default (ie in workspace folder) or in SDK?
If I select default I move on to selecting the archetype (in this case 0.0.1-SNAPSHOT I believe).
I add the <properties> section but then get a series of errors reported:
Missing artifact com.liferay.portal:portal-service:jar:0.0.1-SNAPSHOT in section:


the Web project Settings just has MavenTest ( no "-portlet)

So I have no idea if things are working properly
This test was done with the latest IDE code taken from the Milestones feed.

I have to ask myself though, why do you have to do all these steps? Is this what the Liferay m2e code is meant to help automate?

I also noticed in the SDK that when creating a Liferay Project (eg hook) it didn't save it in the SDK hooks folder but the workspace folder. Why is that?

The Maven documentation here is so spread out and un-linked (or linking to old blog posts) that it is extremely hard to follow.

Can anyone help by updating this with some explanations of what is going on and why?
Postado em 16/12/13 20:41.
Hi Dave,
First I am sorry for replying you so late.

About your question "Which folder a maven project generated?". The characteristics of maven project is we do not need to configure SDK. So the default folder will be the workspace folder instead of SDK folder.

And another question, there used to be a bug in the suffix problem, but it has been fixed. So if you download the latest IDE version, in the Web project Settings you can see the suffix now.
Postado em 01/01/14 19:13 em resposta a Dave Weitzel.