Sign in

E-mail *, (xx@domain.com)
Password *

Register | Forgot password

Blogs

Recent blogs

RSS - Blogs
March 9, 2010
State of OSGi in the Java world
March 4, 2010
Reach more people with Google Translate
March 3, 2010
Get My Advice
February 26, 2010
What? Where!?!
February 11, 2010
Split it!

All Blogs...


Maven FTW!

March 11, 2008

Has anyone ever stopped and gazed at the marvellous wonder called Maven? It slices, it dices and I bet that if it were included, it would even play Office Space for you. All you need to do is point it at the nearest sensible "settings.xml" and issue a command.

mvn -s settings.xml -P configure-jcr-repository
mvn -s settings.xml -P create-mysql-db
A quick glance at GX WebManager's "installation.txt" already reveals numerous uses:


These babies configure your JCR repository and create a freshly initialized MySQL database for you. You only have to do this when you are setting up a fresh site.

mvn -s settings.xml -P build-project clean package

This will build GX WebManager so you can run it. Once it is built, there are two things you can do. Either use the internal servlet container to run it:

mvn -s settings.xml -P run-project

or, alternatively, use Apache Tomcat to run it. Which, incidentally, comes in its standard distribution form in the "ext" directory. Unpack that and you can generate a working "startup.bat" and "server.xml" with the command:

mvn -s settings.xml -P configure-tomcat
After this, Tomcat can be started to run GX WebManager for you.
"Impressive... Most impressive!", would Darth Vader say.

But there is more!

By now, you will have noticed the recurring "-s settings.xml" in the commandline. That settings file is where Maven retrieves its smartness from (actually, that and several "pom.xml" files). It is up to you to make sure the settings are correct for your environment. Once you have a good "settings.xml file", you can use it from other directories by using the whole path name. The following examples assume there is a "C:\GX\WebManager9\settings.xml" to use.

The following command will create a brand spanking new presentation template for you to fill in:

mvn archetype:create -DarchetypeGroupId=nl.gx.webmanager.archetypes -DarchetypeArtifactId=webmanager-presentation-archetype -DarchetypeVersion=9.3.3 -DgroupId=helloworld -DartifactId=helloworldpresentation -DpackageName=nl.gx.product -s C:\GX\WebManager9\settings.xml
Yes, that was one line! Thank the gods for the invention copy & paste... The command will create a "helloworldpresentation" directory for you with a very basic set of files in it, to get you started on creating your own presentation.

There are more templates to help you out. Check the Quick Start Guide for the others.

And since you are developing, you will probably want to use Eclipse, so we might as well generate a .project configuration file for it:
mvn -s C:\GX\WebManager9\settings.xml eclipse:eclipse

When you are done developing, build and package your WCB using:

mvn -s C:\GX\WebManager9\settings.xml clean package

A freshly baked "helloworldpresentation-1.0.jar" file will appear in the "target" directory. Upload to WebManager with the WCB Management console and you are ready to admire your work.

Finally, when you are ready to deploy everything to a production environment, there is one last thing Maven can do to assist you:

mvn -s productionsettings.xml -P build-deploy clean package assembly:assembly
The result will be one humongous .war file that contains everything including static files and such. Install it on the production environment for maximum enjoyment.

As you can see, there are numerous reasons to love Maven in combination with GX WebManager!



Ah well, it was worth a shot... Till next time!


Greetings,


Patrick

About the Author

Return to all blogs

 

Patrick Atoon

Patrick Atoon has gained nuff respect as one of the most experienced web architects in the GX Webmanager community or even the global hip hop community for that matter.

Read all Patricks blog entries

Other blog entries:

February 26, 2010
What? Where!?!
September 3, 2009
Do the Right Thing
June 18, 2009
wm:link secrets
March 2, 2009
Server side represent! (Part 2)
February 4, 2009
Server side represent!
January 15, 2009
Making cache
December 9, 2008
Like A Version
August 19, 2008
Stop making sense
August 4, 2008
Namaste!
July 7, 2008
Japanese encore (日本のアンコール)


Share:

del.icio.us
digg
Technorati
Slashdot
Reddit
YahooMyWeb
NewsVine
ekudos
© 2010 GX creative online development B.V.

Disclaimer

This website (GXdeveloperweb.com) may discuss or contain opinions, (sample) coding, software or other information that does not include GX official interfaces, instructions or guidelines and therefore is not supported by GX. Changes made based on this information are not supported.  GX will not be held liable for any damages caused by using or misusing the information, software, instructions, code or methods suggested on this website, and anyone using these methods does so at his/her own risk. GX offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this website, including any liability resulting from incompatibility between the content of this website and the materials and services offered by GX. By using this website you will not hold, or seek to hold, GX responsible or liable with respect to the content of this website.