SlideShare uma empresa Scribd logo
1 de 26
Baixar para ler offline
Developing Liferay Plugins with
Maven
Mika Koivisto
Senior Software Engineer
Agenda
•   Quick Introduction to Maven
•   Liferay Maven Support
•   Demo
•   Future Plans
Quick Introduction to Maven
• Project management tool (build, test, report, assemble,
    release)
•   Small core expandable with plugins
•   Convention over configuration
•   Dependency management
•   Common lifecycle
Typical Ant build.xml
<project name="my-project" default="dist" basedir=".">
    <property name="src" location="src/main/java"/>
    <property name="build" location="target/classes"/>
    <property name="dist" location="target"/>

    <target name="init">
        <tstamp/>
        <mkdir dir="${build}"/>
    </target>

    <target name="compile" depends="init" description="compile the source " >
        <javac srcdir="${src}" destdir="${build}"/>
    </target>

    <target name="dist" depends="compile">
        <mkdir dir="${dist}/lib"/>

       <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
    </target>

    <target name="clean">
        <delete dir="${build}"/>
        <delete dir="${dist}"/>
    </target>
</project>
Same in Maven
<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.liferay.sample</groupId>
    <artifactId>my-project</artifactId>
    <version>1.0-SNAPSHOT</version>
</project>
The Project Object Model
•   Analogous to Makefile or build.xml
•   Versioned <major>.<minor>.<increment>-<qualifier>
•   Packaging (pom, jar, war, ejb, ear, etc.)
•   Inheritance
•   Sub-modules
•   Dependencies
•   Profiles
•   Properties
Dependency Management
• Declarative
• Transitive
• Identified by: groupId, artifactId, version and type
  combination
• Scoped: compile, provided, runtime, test or system
Build Lifecycle
•   Build-in lifecycles: default, clean and site
•   Lifecycles have phases
•   Goals are attached to phases
•   Common phases:
    •   clean
    •   compile
    •   test
    •   package
    •   install
    •   deploy
Repositories
• Place where all artifacts are stored
• Local
  • Located in USER_HOME/.m2/repository
  • Cached copy of downloaded artifacts
  • Contains locally installed artifacts
• Remote
  • Central
  • Internal or external
  • Proxy or Cache
What is Artifact?
• Product of build
• Described by pom.xml
• Identified with combination of groupId, artifactId, version
  and qualifier
What is Archetype?
• Project template
• Available for various project types
• Run mvn archetype:generate to create interactively or
  specify with parameters
   mvn archetype:generate 
      -DarchetypeArtifactId=liferay-portlet-archetype 
      -DarchetypeGroupId=com.liferay.maven.archetypes 
      -DarchetypeVersion=6.1.0 
      -DgroupId=com.liferay.sample 
      -DartifactId=sample-portlet 
      -Dversion=1.0-SNAPSHOT 
      -DinteractiveMode=false
Liferay Maven Support
• Alternative to ant based plugins sdk
• Compatible with both Liferay 6.1 CE and EE
• CE Portal Artifacts published to Maven Central
  Repository
• EE Portal Artifacts downloadable from Customer Portal
• Liferay Maven Plugin and Archetypes published to Maven
  Central Repository for both CE and EE
Liferay Portal Artifacts
• GroupId: com.liferay.portal
• ArtifactId:
  • portal-client
  • portal-impl
  • portal-service
  • portal-web
  • support-tomcat
  • util-bridges
  • util-java
  • util-taglib
Liferay Maven Plugin
• GroupId: com.liferay.maven.plugins
• ArtifactId: liferay-maven-plugin
• Brings features from Plugins SDK to Maven
  • Service Builder
  • Theme diffs
  • Direct Deployment
Liferay Maven Plugin Goals
•   liferay:build-ext
•   liferay:build-lang
•   liferay:build-service
•   liferay:build-thumbnail
•   liferay:build-wsdd
•   liferay:deploy
•   liferay:direct-deploy
•   liferay:theme-merge
Liferay Archetypes
• GroupId: com.liferay.maven.archetypes
• ArtifactId:
  • liferay-ext-archetype
  • liferay-hook-archetype
  • liferay-layouttpl-archetype
  • liferay-portlet-archetype
  • liferay-servicebuilder-archetype
  • liferay-theme-archetype
  • liferay-web-archetype
Demo
Parent Project
• Vaguely equivalent to plugins sdk instance
• Includes all the project modules such as:
  • Portlets
  • Themes
  • Layouts
• Contains common project properties such as used Liferay
  version
Sample Parent Project Pom
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	     <modelVersion>4.0.0</modelVersion>
	     <groupId>com.liferay.sample</groupId>
	     <artifactId>helloworld-project</artifactId>
	     <version>1.0-SNAPSHOT</version>
	     <packaging>pom</packaging>
	     <properties>
	     	     <liferay.version>6.1.10</liferay.version>
	     	     <liferay.auto.deploy.dir>/opt/liferay-portal-6.1.10-ee-ga1/deploy</liferay.auto.deploy.dir>
	     </properties>

</project>
Theme Module
• Merges with parent theme
     during packaging
• Parent theme defined in
     pom.xml
• Parent can be built-in theme
     or any war artifact
• Deploy with
mvn liferay:deploy
or
mvn liferay:direct-deploy -DdeployDir=/

opt/liferay/tomcat/webapps
Service Builder Module
• Creates separate portlet and
     service api sub projects
• Build service from -portlet
mvn liferay:build-service

• Deploy from -portlet
mvn liferay:deploy
or
mvn liferay:direct-deploy -DdeployDir=/

opt/liferay/tomcat/webapps
Ext Plugin Module
• Similar structure to plugins
   sdk but mavenized
• Build service from -ext-impl
mvn liferay:build-service
-DserviceFileName=src/main/resources/
com/liferay/sample/service.xml

• Deploy from -ext
mvn liferay:build-service
-DserviceFileName=src/main/resources/
com/liferay/sample/service.xml
Maven Best Practices
• Setup internal repository and maven proxy
  • Reduces build time by caching dependencies
  • Increases build stability and repeatability
  • Allows enforcing company policies
• Never use 3rd party SNAPHOT dependencies
• Declare all your dependencies and don’t rely on transitive
  dependencies for classes you use
Future Plans
• IDE integration
  • Liferay IDE
  • Liferay Developer Studio
• More archetypes (liferay faces, spring mvc, etc.)
• Liferay Bundle Builder
Contributing
• Github project
  https://github.com/liferay/liferay-maven-support
• JIRA
  http://issues.liferay.com/browse/MAVEN
Contact

 Email: mika.koivisto@liferay.com
 Twitter: @koivimik
 Github: mikakoivisto

Mais conteúdo relacionado

Mais procurados

GREZIAKO ESKULTURA
GREZIAKO ESKULTURAGREZIAKO ESKULTURA
GREZIAKO ESKULTURAasunasenjo
 
Izurrite beltza (1)
Izurrite beltza (1)Izurrite beltza (1)
Izurrite beltza (1)Gernikagiza
 
Historiaurrea .5. MAILA B- D taldea
Historiaurrea .5. MAILA B-  D taldeaHistoriaurrea .5. MAILA B-  D taldea
Historiaurrea .5. MAILA B- D taldeamendigoiti
 
La Prehistoria características y Arte.
 La Prehistoria características y Arte. La Prehistoria características y Arte.
La Prehistoria características y Arte.axelsulbaran
 
PALEOLITOA - GURE ARBASORIK ZAHARRENAK
PALEOLITOA - GURE ARBASORIK ZAHARRENAKPALEOLITOA - GURE ARBASORIK ZAHARRENAK
PALEOLITOA - GURE ARBASORIK ZAHARRENAKIES F.J.Z. BHI
 
Atapuerca: la wikipedia de la Prehistoria
Atapuerca: la wikipedia de la PrehistoriaAtapuerca: la wikipedia de la Prehistoria
Atapuerca: la wikipedia de la Prehistoriaprofeshispanica
 

Mais procurados (10)

GREZIAKO ESKULTURA
GREZIAKO ESKULTURAGREZIAKO ESKULTURA
GREZIAKO ESKULTURA
 
Els boscos del pirineu
Els boscos del pirineuEls boscos del pirineu
Els boscos del pirineu
 
Izurrite beltza (1)
Izurrite beltza (1)Izurrite beltza (1)
Izurrite beltza (1)
 
Historiaurrea .5. MAILA B- D taldea
Historiaurrea .5. MAILA B-  D taldeaHistoriaurrea .5. MAILA B-  D taldea
Historiaurrea .5. MAILA B- D taldea
 
Prehistoria
PrehistoriaPrehistoria
Prehistoria
 
La prehistòria
La prehistòriaLa prehistòria
La prehistòria
 
La Prehistoria características y Arte.
 La Prehistoria características y Arte. La Prehistoria características y Arte.
La Prehistoria características y Arte.
 
PALEOLITOA - GURE ARBASORIK ZAHARRENAK
PALEOLITOA - GURE ARBASORIK ZAHARRENAKPALEOLITOA - GURE ARBASORIK ZAHARRENAK
PALEOLITOA - GURE ARBASORIK ZAHARRENAK
 
Prehistoria
PrehistoriaPrehistoria
Prehistoria
 
Atapuerca: la wikipedia de la Prehistoria
Atapuerca: la wikipedia de la PrehistoriaAtapuerca: la wikipedia de la Prehistoria
Atapuerca: la wikipedia de la Prehistoria
 

Destaque

Liferay Developer Best Practices for a Successful Deployment
Liferay Developer Best Practices for a Successful DeploymentLiferay Developer Best Practices for a Successful Deployment
Liferay Developer Best Practices for a Successful Deploymentrivetlogic
 
J2EE Technology Mapping-21-may-2014
J2EE Technology Mapping-21-may-2014J2EE Technology Mapping-21-may-2014
J2EE Technology Mapping-21-may-2014Nguyen Tung
 
Architecture Patterns - Open Discussion
Architecture Patterns - Open DiscussionArchitecture Patterns - Open Discussion
Architecture Patterns - Open DiscussionNguyen Tung
 
Liferay Portal Introduction
Liferay Portal IntroductionLiferay Portal Introduction
Liferay Portal IntroductionNguyen Tung
 
OOD Principles and Patterns
OOD Principles and PatternsOOD Principles and Patterns
OOD Principles and PatternsNguyen Tung
 
Portlet Framework: the Liferay way
Portlet Framework: the Liferay wayPortlet Framework: the Liferay way
Portlet Framework: the Liferay wayriround
 
SaaS Introduction-May2014
SaaS Introduction-May2014SaaS Introduction-May2014
SaaS Introduction-May2014Nguyen Tung
 
Microservice Architecture
Microservice ArchitectureMicroservice Architecture
Microservice ArchitectureNguyen Tung
 
Portets to composite applications
Portets to composite applicationsPortets to composite applications
Portets to composite applicationsSerge Huber
 
Maven plugin guide using Modello Framework
Maven plugin guide using Modello FrameworkMaven plugin guide using Modello Framework
Maven plugin guide using Modello Frameworkfulvio russo
 
Alfresco P Tardif V1 0 Mars 2009
Alfresco   P Tardif V1 0   Mars 2009Alfresco   P Tardif V1 0   Mars 2009
Alfresco P Tardif V1 0 Mars 2009tardifpa
 
7 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 2016
7 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 20167 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 2016
7 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 2016Sébastien Le Marchand
 
EclipseCon Europe 2015 - liferay modularity patterns using OSGi -Rafik Harabi
EclipseCon Europe 2015 - liferay modularity patterns using OSGi -Rafik HarabiEclipseCon Europe 2015 - liferay modularity patterns using OSGi -Rafik Harabi
EclipseCon Europe 2015 - liferay modularity patterns using OSGi -Rafik HarabiRafik HARABI
 
Chatbot in Sale Management
Chatbot in Sale ManagementChatbot in Sale Management
Chatbot in Sale ManagementVõ Duy Tuấn
 
Introduction to Portlets Using Liferay Portal
Introduction to Portlets Using Liferay PortalIntroduction to Portlets Using Liferay Portal
Introduction to Portlets Using Liferay Portalrivetlogic
 
Présentation Ippon DGA Liferay Symposium 2011
Présentation Ippon DGA Liferay Symposium 2011Présentation Ippon DGA Liferay Symposium 2011
Présentation Ippon DGA Liferay Symposium 2011Ippon
 

Destaque (20)

Liferay Developer Best Practices for a Successful Deployment
Liferay Developer Best Practices for a Successful DeploymentLiferay Developer Best Practices for a Successful Deployment
Liferay Developer Best Practices for a Successful Deployment
 
J2EE Technology Mapping-21-may-2014
J2EE Technology Mapping-21-may-2014J2EE Technology Mapping-21-may-2014
J2EE Technology Mapping-21-may-2014
 
Architecture Patterns - Open Discussion
Architecture Patterns - Open DiscussionArchitecture Patterns - Open Discussion
Architecture Patterns - Open Discussion
 
Liferay Portal Introduction
Liferay Portal IntroductionLiferay Portal Introduction
Liferay Portal Introduction
 
Liferay maven sdk
Liferay maven sdkLiferay maven sdk
Liferay maven sdk
 
OOD Principles and Patterns
OOD Principles and PatternsOOD Principles and Patterns
OOD Principles and Patterns
 
Portlet Framework: the Liferay way
Portlet Framework: the Liferay wayPortlet Framework: the Liferay way
Portlet Framework: the Liferay way
 
SAML and Liferay
SAML and LiferaySAML and Liferay
SAML and Liferay
 
SaaS Introduction-May2014
SaaS Introduction-May2014SaaS Introduction-May2014
SaaS Introduction-May2014
 
Microservice Architecture
Microservice ArchitectureMicroservice Architecture
Microservice Architecture
 
Portets to composite applications
Portets to composite applicationsPortets to composite applications
Portets to composite applications
 
Maven plugin guide using Modello Framework
Maven plugin guide using Modello FrameworkMaven plugin guide using Modello Framework
Maven plugin guide using Modello Framework
 
Alfresco P Tardif V1 0 Mars 2009
Alfresco   P Tardif V1 0   Mars 2009Alfresco   P Tardif V1 0   Mars 2009
Alfresco P Tardif V1 0 Mars 2009
 
7 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 2016
7 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 20167 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 2016
7 plugins de la communauté à ne pas manquer ! - Liferay France Symposium 2016
 
Portal Presention
Portal PresentionPortal Presention
Portal Presention
 
EclipseCon Europe 2015 - liferay modularity patterns using OSGi -Rafik Harabi
EclipseCon Europe 2015 - liferay modularity patterns using OSGi -Rafik HarabiEclipseCon Europe 2015 - liferay modularity patterns using OSGi -Rafik Harabi
EclipseCon Europe 2015 - liferay modularity patterns using OSGi -Rafik Harabi
 
Chatbot in Sale Management
Chatbot in Sale ManagementChatbot in Sale Management
Chatbot in Sale Management
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Introduction to Portlets Using Liferay Portal
Introduction to Portlets Using Liferay PortalIntroduction to Portlets Using Liferay Portal
Introduction to Portlets Using Liferay Portal
 
Présentation Ippon DGA Liferay Symposium 2011
Présentation Ippon DGA Liferay Symposium 2011Présentation Ippon DGA Liferay Symposium 2011
Présentation Ippon DGA Liferay Symposium 2011
 

Semelhante a Developing Liferay Plugins with Maven

Intelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulMert Çalışkan
 
BMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenBMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenMert Çalışkan
 
Maven introduction in Mule
Maven introduction in MuleMaven introduction in Mule
Maven introduction in MuleShahid Shaik
 
Introduction to Maven
Introduction to MavenIntroduction to Maven
Introduction to MavenSperasoft
 
Maven 3 Overview
Maven 3  OverviewMaven 3  Overview
Maven 3 OverviewMike Ensor
 
Introduction tomaven
Introduction tomavenIntroduction tomaven
Introduction tomavenManav Prasad
 
How maven makes your development group look like a bunch of professionals.
How maven makes your development group look like a bunch of professionals.How maven makes your development group look like a bunch of professionals.
How maven makes your development group look like a bunch of professionals.Fazreil Amreen Abdul Jalil
 
Lorraine JUG (1st June, 2010) - Maven
Lorraine JUG (1st June, 2010) - MavenLorraine JUG (1st June, 2010) - Maven
Lorraine JUG (1st June, 2010) - MavenArnaud Héritier
 
Apache Maven - eXo TN presentation
Apache Maven - eXo TN presentationApache Maven - eXo TN presentation
Apache Maven - eXo TN presentationArnaud Héritier
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - ExplainedSmita Prasad
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO DevsWO Community
 

Semelhante a Developing Liferay Plugins with Maven (20)

Maven
MavenMaven
Maven
 
Intelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest Istanbul
 
BMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenBMO - Intelligent Projects with Maven
BMO - Intelligent Projects with Maven
 
Maven introduction in Mule
Maven introduction in MuleMaven introduction in Mule
Maven introduction in Mule
 
Maven
MavenMaven
Maven
 
Maven
MavenMaven
Maven
 
Maven in Mule
Maven in MuleMaven in Mule
Maven in Mule
 
Introduction to Maven
Introduction to MavenIntroduction to Maven
Introduction to Maven
 
Maven 3 Overview
Maven 3  OverviewMaven 3  Overview
Maven 3 Overview
 
4 maven junit
4 maven junit4 maven junit
4 maven junit
 
Introduction tomaven
Introduction tomavenIntroduction tomaven
Introduction tomaven
 
How maven makes your development group look like a bunch of professionals.
How maven makes your development group look like a bunch of professionals.How maven makes your development group look like a bunch of professionals.
How maven makes your development group look like a bunch of professionals.
 
Maven basic concept
Maven basic conceptMaven basic concept
Maven basic concept
 
Lorraine JUG (1st June, 2010) - Maven
Lorraine JUG (1st June, 2010) - MavenLorraine JUG (1st June, 2010) - Maven
Lorraine JUG (1st June, 2010) - Maven
 
Apache Maven - eXo TN presentation
Apache Maven - eXo TN presentationApache Maven - eXo TN presentation
Apache Maven - eXo TN presentation
 
Session 2
Session 2Session 2
Session 2
 
Session 2
Session 2Session 2
Session 2
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - Explained
 
Apache Maven
Apache MavenApache Maven
Apache Maven
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO Devs
 

Último

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 

Último (20)

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 

Developing Liferay Plugins with Maven

  • 1. Developing Liferay Plugins with Maven Mika Koivisto Senior Software Engineer
  • 2. Agenda • Quick Introduction to Maven • Liferay Maven Support • Demo • Future Plans
  • 3. Quick Introduction to Maven • Project management tool (build, test, report, assemble, release) • Small core expandable with plugins • Convention over configuration • Dependency management • Common lifecycle
  • 4. Typical Ant build.xml <project name="my-project" default="dist" basedir="."> <property name="src" location="src/main/java"/> <property name="build" location="target/classes"/> <property name="dist" location="target"/> <target name="init"> <tstamp/> <mkdir dir="${build}"/> </target> <target name="compile" depends="init" description="compile the source " > <javac srcdir="${src}" destdir="${build}"/> </target> <target name="dist" depends="compile"> <mkdir dir="${dist}/lib"/> <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/> </target> <target name="clean"> <delete dir="${build}"/> <delete dir="${dist}"/> </target> </project>
  • 5. Same in Maven <project> <modelVersion>4.0.0</modelVersion> <groupId>com.liferay.sample</groupId> <artifactId>my-project</artifactId> <version>1.0-SNAPSHOT</version> </project>
  • 6. The Project Object Model • Analogous to Makefile or build.xml • Versioned <major>.<minor>.<increment>-<qualifier> • Packaging (pom, jar, war, ejb, ear, etc.) • Inheritance • Sub-modules • Dependencies • Profiles • Properties
  • 7. Dependency Management • Declarative • Transitive • Identified by: groupId, artifactId, version and type combination • Scoped: compile, provided, runtime, test or system
  • 8. Build Lifecycle • Build-in lifecycles: default, clean and site • Lifecycles have phases • Goals are attached to phases • Common phases: • clean • compile • test • package • install • deploy
  • 9. Repositories • Place where all artifacts are stored • Local • Located in USER_HOME/.m2/repository • Cached copy of downloaded artifacts • Contains locally installed artifacts • Remote • Central • Internal or external • Proxy or Cache
  • 10. What is Artifact? • Product of build • Described by pom.xml • Identified with combination of groupId, artifactId, version and qualifier
  • 11. What is Archetype? • Project template • Available for various project types • Run mvn archetype:generate to create interactively or specify with parameters mvn archetype:generate -DarchetypeArtifactId=liferay-portlet-archetype -DarchetypeGroupId=com.liferay.maven.archetypes -DarchetypeVersion=6.1.0 -DgroupId=com.liferay.sample -DartifactId=sample-portlet -Dversion=1.0-SNAPSHOT -DinteractiveMode=false
  • 12. Liferay Maven Support • Alternative to ant based plugins sdk • Compatible with both Liferay 6.1 CE and EE • CE Portal Artifacts published to Maven Central Repository • EE Portal Artifacts downloadable from Customer Portal • Liferay Maven Plugin and Archetypes published to Maven Central Repository for both CE and EE
  • 13. Liferay Portal Artifacts • GroupId: com.liferay.portal • ArtifactId: • portal-client • portal-impl • portal-service • portal-web • support-tomcat • util-bridges • util-java • util-taglib
  • 14. Liferay Maven Plugin • GroupId: com.liferay.maven.plugins • ArtifactId: liferay-maven-plugin • Brings features from Plugins SDK to Maven • Service Builder • Theme diffs • Direct Deployment
  • 15. Liferay Maven Plugin Goals • liferay:build-ext • liferay:build-lang • liferay:build-service • liferay:build-thumbnail • liferay:build-wsdd • liferay:deploy • liferay:direct-deploy • liferay:theme-merge
  • 16. Liferay Archetypes • GroupId: com.liferay.maven.archetypes • ArtifactId: • liferay-ext-archetype • liferay-hook-archetype • liferay-layouttpl-archetype • liferay-portlet-archetype • liferay-servicebuilder-archetype • liferay-theme-archetype • liferay-web-archetype
  • 17. Demo
  • 18. Parent Project • Vaguely equivalent to plugins sdk instance • Includes all the project modules such as: • Portlets • Themes • Layouts • Contains common project properties such as used Liferay version
  • 19. Sample Parent Project Pom <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.liferay.sample</groupId> <artifactId>helloworld-project</artifactId> <version>1.0-SNAPSHOT</version> <packaging>pom</packaging> <properties> <liferay.version>6.1.10</liferay.version> <liferay.auto.deploy.dir>/opt/liferay-portal-6.1.10-ee-ga1/deploy</liferay.auto.deploy.dir> </properties> </project>
  • 20. Theme Module • Merges with parent theme during packaging • Parent theme defined in pom.xml • Parent can be built-in theme or any war artifact • Deploy with mvn liferay:deploy or mvn liferay:direct-deploy -DdeployDir=/ opt/liferay/tomcat/webapps
  • 21. Service Builder Module • Creates separate portlet and service api sub projects • Build service from -portlet mvn liferay:build-service • Deploy from -portlet mvn liferay:deploy or mvn liferay:direct-deploy -DdeployDir=/ opt/liferay/tomcat/webapps
  • 22. Ext Plugin Module • Similar structure to plugins sdk but mavenized • Build service from -ext-impl mvn liferay:build-service -DserviceFileName=src/main/resources/ com/liferay/sample/service.xml • Deploy from -ext mvn liferay:build-service -DserviceFileName=src/main/resources/ com/liferay/sample/service.xml
  • 23. Maven Best Practices • Setup internal repository and maven proxy • Reduces build time by caching dependencies • Increases build stability and repeatability • Allows enforcing company policies • Never use 3rd party SNAPHOT dependencies • Declare all your dependencies and don’t rely on transitive dependencies for classes you use
  • 24. Future Plans • IDE integration • Liferay IDE • Liferay Developer Studio • More archetypes (liferay faces, spring mvc, etc.) • Liferay Bundle Builder
  • 25. Contributing • Github project https://github.com/liferay/liferay-maven-support • JIRA http://issues.liferay.com/browse/MAVEN
  • 26. Contact Email: mika.koivisto@liferay.com Twitter: @koivimik Github: mikakoivisto