SlideShare una empresa de Scribd logo
1 de 26
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

Paul Washer - One True God
Paul Washer - One True GodPaul Washer - One True God
Paul Washer - One True God
guest8323e61
 
Mengidentifikasi berbagai komponen perangkat keras
Mengidentifikasi berbagai komponen perangkat kerasMengidentifikasi berbagai komponen perangkat keras
Mengidentifikasi berbagai komponen perangkat keras
Faridiraf Sama Aja
 
Modul teori basis data ch. 2
Modul teori basis data ch. 2Modul teori basis data ch. 2
Modul teori basis data ch. 2
Ratzman III
 

La actualidad más candente (20)

Miguel é jesus
Miguel é jesusMiguel é jesus
Miguel é jesus
 
Paul Washer - One True God
Paul Washer - One True GodPaul Washer - One True God
Paul Washer - One True God
 
kisi-kisi soal TIK.doc
kisi-kisi soal TIK.dockisi-kisi soal TIK.doc
kisi-kisi soal TIK.doc
 
Amós estudo 01 -
Amós   estudo 01 -Amós   estudo 01 -
Amós estudo 01 -
 
Dedi Purwanto - Proses - proses Sistem Operasi
Dedi Purwanto - Proses - proses Sistem OperasiDedi Purwanto - Proses - proses Sistem Operasi
Dedi Purwanto - Proses - proses Sistem Operasi
 
54 Estudo Panorâmico da Bíblia (Esdras)
54   Estudo Panorâmico da Bíblia (Esdras)54   Estudo Panorâmico da Bíblia (Esdras)
54 Estudo Panorâmico da Bíblia (Esdras)
 
Disk operating system
Disk operating systemDisk operating system
Disk operating system
 
Mengidentifikasi berbagai komponen perangkat keras
Mengidentifikasi berbagai komponen perangkat kerasMengidentifikasi berbagai komponen perangkat keras
Mengidentifikasi berbagai komponen perangkat keras
 
Oracle User Management
Oracle User ManagementOracle User Management
Oracle User Management
 
MODUL AJAR INFORMATIKA 4 - JARINGAN KOMPUTER DAN INTERNET.pdf
MODUL AJAR INFORMATIKA 4 - JARINGAN KOMPUTER DAN INTERNET.pdfMODUL AJAR INFORMATIKA 4 - JARINGAN KOMPUTER DAN INTERNET.pdf
MODUL AJAR INFORMATIKA 4 - JARINGAN KOMPUTER DAN INTERNET.pdf
 
Rpp pemrograman dasar kelas 10 semester ganjil
Rpp pemrograman dasar kelas 10 semester ganjilRpp pemrograman dasar kelas 10 semester ganjil
Rpp pemrograman dasar kelas 10 semester ganjil
 
Modul teori basis data ch. 2
Modul teori basis data ch. 2Modul teori basis data ch. 2
Modul teori basis data ch. 2
 
Tabernáculo da fé e a maçonaria
Tabernáculo da fé e a maçonariaTabernáculo da fé e a maçonaria
Tabernáculo da fé e a maçonaria
 
3. as visões de daniel
3. as visões de daniel3. as visões de daniel
3. as visões de daniel
 
C++ &amp; python
C++ &amp; pythonC++ &amp; python
C++ &amp; python
 
Komponen komputer dan fungsinya
Komponen komputer dan fungsinyaKomponen komputer dan fungsinya
Komponen komputer dan fungsinya
 
22. o livro de ester
22. o livro de ester22. o livro de ester
22. o livro de ester
 
Pengenalan Dasar Web
Pengenalan Dasar WebPengenalan Dasar Web
Pengenalan Dasar Web
 
LIÇÃO 03 - ABRAÃO, A ESPERANÇA DO PAI DA FÉ
LIÇÃO 03 - ABRAÃO, A ESPERANÇA DO PAI DA FÉLIÇÃO 03 - ABRAÃO, A ESPERANÇA DO PAI DA FÉ
LIÇÃO 03 - ABRAÃO, A ESPERANÇA DO PAI DA FÉ
 
03 Israel e as Profecias Bíblicas
03   Israel e as Profecias Bíblicas03   Israel e as Profecias Bíblicas
03 Israel e as Profecias Bíblicas
 

Destacado

Destacado (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
 

Similar a Developing Liferay Plugins with Maven

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
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO Devs
WO Community
 

Similar 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

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
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)
 
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
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
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, ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 

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