You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

maven-waf branch

This article depends on the maven-waf branch

Maven uses the notion of a build life-cycle to which plugins can attach. Plugins are similar to Ant tasks. When a Maven build is invoked, we specify a point in the life-cycle up to which the build should proceed. The compile phase comes before test, and test comes before package, and package comes before install. Once we have Maven setup, we can invoke the Struts build, and specify which phase the build should use.

Installing Maven

Get Maven binary: http://maven.apache.org/download.html

For Mac and Linux:

Extract the latest stable binary release to /usr/local/maven

Add following to your .zshrc/.bashrc/.aliasrc:

export M2_HOME=/usr/local/maven
export PATH=${M2_HOME}/bin:${PATH}

For Windows: FIXME

Understanding POMs

POMs are top level build configuration files.

To debug POMs, read through the effective POM:

$ mvn help:effective-pom

Dependencies

Running mvn in source root will download and setup dependency jars in ~/.m2/repository.

$ mvn
$ mvn -P deps # or, explicitly specify the profile

Some modules require dependencies that are not freely available or have an incompatible license. These dependencies you need to donwload yourself. See to following instructions to add them to your maven repository.

1. Download the following jars and put them in the deps directory:

  • cloud-iControl.jar
  • cloud-netscaler.jar
  • cloud-netscaler-sdx.jar
  • cloud-manageontap.jar
  • vmware-vim.jar
  • vmware-vim25.jar
  • vmware-apputils.jar

2. Go into the deps directory and run install-non-oss.sh

$ cd deps
$ ./install-non-oss.sh

If you want all dependencies downloaded into the deps folder (handy for ant builds)

$ mvn -P deps -pl deps

Building CloudStack

Running the maven command in the top directory of the CloudStack sources will compile all sources for CloudStack and run the unittests. The resulting jar files will be in the directory target in the subdirectory for a particular module. The default build will have all components that depends on non OpenSource libraries disabled. If you want to enable this, just add -D nonoss to the mvn command line.

$ mvn [-D nonoss]

Temporary Build Process on ASF Master

$ rm -fr ~/.m2
$ cd incubator-cloudstack
$ mvn -P deps
$ ant clean-all build-all
$ ant deploy-server # ant deploy-server before you deploydb
$ ant deploydb # usual ant stuff :)

Building RPM packages

Use waf to build packages for linux systems that use rpms, like RedHat, CentOS and fedora.

prerelease flag

This flag is required as this makes the RPM use the SNAPSHOT versions.

$ waf --package-version=4.0.0 --prerelease=rc1 --build-number=1 --oss rpm
$ mvn install -P deps && ./waf rpm

Building DEB packages

On Master:

$ mvn install -P deps && dpkg-buildpackage

Development

Starting the debug server from maven

This replaces the old ant debug, but you still have to deploy the database using 'ant deploydb' for now.

Under development

This feature is still being developed and tested, might not work as expected

$ mvn -P client -pl client jetty:run

Good Ol' Terminal

Zsh/Bash/Emacs/Vim/Grep/Sed/Awk/Javac...

$ sh deps/install-non-oss.sh

$ mvn -Dnonoss install

$ ant debug # Good ol' way of doing things

IntelliJ IDEA

FIXME: Add on how to use IntelliJ IDEA with CS, building, debugging, editing, git checkouts

Eclipse

FIXME: Add on how to use Eclipse with CS, building, debugging, editing, git checkouts

Site Generation and Reporting

$ mvn site

Troubleshooting

  • Offline Mode:
$ mvn -o -Pextras,plugins,xwork
  • Out of memory error, out of heap space:
// Bash
export MAVEN_OPTS=-Xmx512m
// Windows
set MAVEN_OPTS=-Xmx512m
  • No labels