Saturday, 19 January 2013

Liferay-Maven: Installation For Beginners

1. Install maven(I have used 3.0 ) and set path for M2_HOME, if you don't know how to install maven, check my previous post here)

2. Take a backup of .m2 and copy whole folder in <documents and settings>/<User>/.m2 folder

3.  Open command prompt( Preferably open liferay SDK folder in command prompt) and type the following instructions

    -> mvn archetype:generate
    -> Select appropriate number for liferay-portlet-archetype(in 3.0 version it is 45)
    -> Enter groupID : com.tcs.srl.etransform
    -> artifactId     : etransform-portlet
   
4. It will create a folder structure with artificatID consisting of src folder and pom.xml. (Replace them with your src folder and pom.xml, if  you have already src file and your customized pom.xml).

5. goto artifact(Here etransform-portlet) and run following instruction
    -> mvn -o package
    It creates target folder and packaged structure

6. mvn clean liferay:deploy to deploy liferay libraries in to portlet.

7. Other liferay maven commands
    mvn liferay:deploy
    mvn liferay:build-lang
    mvn liferay:build-wsdd
    mvn liferay:build-thumbnail   
    mvn liferay:theme-merge
    mvn liferay:build-css
    mvn liferay:build-db
    mvn liferay:build-service
    mvn liferay:direct-deploy   
    mvn liferay:build-ext


8. Other maven commands
    mvn clean    - will delete target directory
    mvn validate    - validate whether project is correct and necessary information is available
    mvn compile    - compile source code and place classes in target/classes folder
    mvn test    - run tests using a suitable unit testing framework
    mvn package    - take the compile code and package it in distributabel format(WAR/JAR as metioned in pom.xml)
    mvn verify    - run any checks to verify the package is valid and meets quality criteria
    mvn install    - install the package into the local repository, for use as a dependency in other projects locally
    mvn deploy    - done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects
   
9. maven eclipse commands
    mvn eclipse:eclipse           
        - create metainformation: meta files for eclipse are created, can be used for project import
    mvn -Dwtpversion=2.0 eclipse:eclipse   
        - create metainformation with wtp: same like create metainformation + WTP plugin infos(To convert into eclipse web project)
    mvn -Declipse.workspace=/path/to/workspace eclipse:add-maven-repo
        - tell eclipse where local repository is located
10. maven release project
    mvn release:prepare
        - prepare release: informations about versions number are collected
    mvn release:clean
        - clean release: rollback to snapshot versions
    mvn release:perform
        - perform release: deploy project to remote repository and make tag in version control system.
            username and password for version control system are taken from server informations in
            ~/.m2/settings.xml. serverID is same like defined in deploymentServer ... this behaviour is not whished
    mvn release:perform -Dusername=foo -Dpassword=bar
        - perform release with username and password for authentication on version control system

   

    mvn deploy:deploy-file -Dfile=/path/to/jar/file -DrepositoryId=repos-server -Durl=http://repos.company.org/test -DgroupId=javax -DartifactId=mail -Dpackaging=jar-Dversion=1.0.1


11. maven tomcat integration(You need to enter tomcat manger ID in pom.xml).
    mvn tomcat:deploy
    mvn tomcat:redeploy
    mvn tomcat:undeploy
    mvn tomcat:stop
    mvn tomcat:start



1 comment:

  1. brillant piece of information, I had come to know about your web-page from my friend hardkik, chennai,i have read atleast 9 posts of yours by now, and let me tell you, your webpage gives the best and the most interesting information. This is just the kind of information that i had been looking for, i'm already your rss reader now and i would regularly watch out for the new posts, once again hats off to you! Thanx a million once again, Regards, liferay training in hyderabad

    ReplyDelete