I create my portlets using Maven, and I'm using Liferay IDE (an eclipse based IDE), but I can't deploy my project directly from Liferay IDE because my project don't support this. There is a way to add the Liferay's capability to the project, but i开发者_运维知识库t don't work ... Can you help please ?
The Maven archetypes and plugin for Liferay allow you to create and deploy portlet projects.
If you import the project into Eclipse as an existing Maven project (using m2eclipse), then you can do a "Run as Maven build" and run "mvn liferay:deploy". If you deploy to, for example, a Tomcat instance running in debug mode in Eclipse, then you'll be able to set breakpoints etc.
You may not even need the "Liferay IDE" as opposed to plain old Eclipse if you do this.
You might have already seen this, but I followed this guide to get started with the Liferay IDE in our project:
http://www.liferay.com/community/wiki/-/wiki/Main/Liferay+IDE+Getting+Started+Tutorial
Hope it helps.
In the current version of Liferay IDE (1.2.x) there is no way to add Liferay IDE project facets to maven based projects. In a future version of Liferay IDE (2.0) there will be Maven support.
For now you will just have to use the ant build.xml scripts for deploying or perhaps the liferay maven plugins which may support deployment.
I know this is an old question, but I want to share this solution, as it took me some time to figure it out. Its an extension to the accepted answer by @Charles Brooking. In my opinion this is better. If you would rather use Eclipse WTP auto deploy with your maven liferay project instead of executing and waiting for mavens build and deploy, this is how you do it.
Step into your eclipse workspace from console and run
mvn archetype:generate -DarchetypeGroupId=com.liferay.maven.archetypes -DarchetypeArtifactId=liferay-portlet-archetype -DarchetypeVersion=6.1.1 -DgroupId=YOURGROUPID -DartifactId=YOUR-PORTLET -Dversion=1.0.0-SNAPSHOT
This creates your mave portlet-project. You can change -DarchetypeArtifactId
to another archetype if you want to start a hook/ext/theme-project instead. Next, step into the project dir you just created called, YOUR-PORTLET. Now edit your pom.xml and add this right before </project>
at the end.
<properties>
<liferay.version>6.1.1</liferay.version>
</properties>
Next issue the command. mvn eclipse:eclipse -Dwtpversion=2.0 This is what ads the eclipse support for auto deploy.
Next we need to add some TLD files manually. Get all .tld files from this Liferay Git repo or hunt them down somewhere else. Put them inside WEB-INF/tld/ in your project and add
<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://liferay.com/tld/aui</taglib-uri>
<taglib-location>/WEB-INF/tld/aui.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/portlet_2_0</taglib-uri>
<taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://liferay.com/tld/portlet</taglib-uri>
<taglib-location>/WEB-INF/tld/liferay-portlet-ext.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://liferay.com/tld/security</taglib-uri>
<taglib-location>/WEB-INF/tld/liferay-security.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://liferay.com/tld/theme</taglib-uri>
<taglib-location>/WEB-INF/tld/liferay-theme.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://liferay.com/tld/ui</taglib-uri>
<taglib-location>/WEB-INF/tld/liferay-ui.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://liferay.com/tld/util</taglib-uri>
<taglib-location>/WEB-INF/tld/liferay-util.tld</taglib-location>
</taglib>
to your web.xml in WEB-INF inside your project. Now you can go to Eclipse and do File, Import, General, "Existing projects into Workspace"
and select your new project. Now you vill be able to do right click on project and select Run, "Run on server"
. Now you can see that your project is deployed and synchronized in the Servers-tab. It will also be auto synchronized when you save your java-classes and jsp-files so changes will be visible on refresh within seconds. Remember that this requires the Eclipse WTP extension and a configured tomcat server in eclipse.
精彩评论