Using Liferay Maven to compile deployment theme in-depth analysis

Source: Internet
Author: User
Tags resource

Today, my colleague asked me where the Liferay framework default resource file was obtained when Maven built theme, and I compared the process of using ant to compile the deployment theme and using MAVEN to compile the deployment theme, discovering that it was a completely different strategy when replicating the framework default resource file!

ANT replication Liferay Policy for default resource files:

As we all know, when you compile theme with ant, we programmers need to add some resource files that are different from the Liferay framework in the _diffs directory, and the Liferay framework itself will have a resource file from $LIFERAY _home\tomcat-7.0.23\ Copy the Webapps\root\html\themes directory to your new theme project.

<copy todir= "Docroot" overwrite= "true" > 
                    <fileset dir= 
                        "${app.server.portal.dir}/html/themes/_" Styled "
                    /> 
                </copy>

MAVEN replicates the policy for Liferay default resource files:

MAVEN does not copy the resource file from Root/html/themes, instead, it is copied from a call Portal-web-6.1.0.war. This war package is in the local warehouse that your machine ~/.m2/repository pointing to: My C:\Documents and settings\charles.wang\.m2 \repository\com\liferay\ The portal\portal-web\6.1.0 directory.

And all this happens in the Liferay-maven-plugin life cycle of the theme-merge stage, when we slow down 10,000 times times, we can clearly see the details of (Taiji essence AH).

The Theme-merge phase is used for our own developed resource files + system resource files Merge into artifact:

First, it defines the relevant environment configuration:

 [Debug]-----------------------------------------------------------------------[Debug] Goal:com.lifera  Y.maven.plugins:liferay-maven-plugin:6.1.0:theme-merge (default) [Debug] style:regular [Debug] Configuration: <?xml version= "1.0" encoding= "UTF-8"?> <configuration> <liferayversion>6.1.0</liferayversion& 
  Gt <localArtifactRepository>${localRepository}</localArtifactRepository> <parenttheme default-value= "_styled" >_styled</parentTheme> <remoteartifactrepositories>${project.remoteartifactrepositories } </remoteArtifactRepositories> <themetype default-value= "VM" >vm</themeType> <webappdir>${ Project.build.directory}/${project.build.finalname}</webappdir> <workdir>${project.build.directory} /liferay-theme/work</workdir> </configuration> 

The final execution Theme-merge corresponding class, located in the Liferay-maven-plugin-6.1.0.jar Thememergemojo class, all the parameters used in the class are written in the configuration file and then passed in:

These parameters are related to your machine running the MAVEN command, because after all you have set up the ~/.m2/repository local warehouse and you have set up Pom.xml, the details of these parameters on my machine can be seen in 02-16 lines:

01.[debug] Configuring Mojo ' Com.liferay.maven.plugins:liferay-maven-plugin:6.1.0:theme-merge ' with basic Configurator-->
02.[debug] (f) liferayversion = 6.1.0
03.[debug] (f) localartifactrepository = Id:local
url:file:///c:/documents%20and%20settings/charles.wang/.m2/repository/
Layout:none
06.
07.[debug] (f) parenttheme = _styled
08.[debug] (f) remoteartifactrepositories = [id:central
Url:http://repo1.maven.org/maven2
Layout:default
11.snapshots: [Enabled => false, Update => daily]
12.releases: [Enabled => true, Update => daily]
13.]
14.[debug] (f) themetype = VM
15.[debug] (f) webappdir = D:\WalmartProject\maven-build-theme\target\maven-build-theme-0.0.1-SNAPSHOT
16.[debug] (f) workdir = D:\WalmartProject\maven-build-theme\target\liferay-theme\work
17.[debug]--End configuration–
18.[debug] Expanding:c:\documents and settings\charles.wang\.m2 \repository\com\liferay\portal\portal-web\6.1.0\ Portal-web-6.1.0.war into D:\WalmartProject\maven-build-theme\target\liferay-theme\work (this line is where to get the log of resource files)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.