...
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.
Table of Contents |
---|
...
Add following to your .zshrc/.bashrc/.aliasrc:
Code Block |
---|
export M2_HOME=/usr/local/maven
export PATH=${M2_HOME}/bin:${PATH}
|
*For Windows: *
Code Block |
---|
Right click on my computer and click on Properties
Click on Advanced system settings
Click on Environment Variables
Click on New... under System variables
Add M2_HOME to Variable name and /usr/local/maven to Variable value
Find Path and click Edit...
Add ;%M2_HOME%/bin at the end
Click OK, OK, and close to get out of all the dialogues
Locate a copy of genosimage.exe. It comes with cygwin and can be copied from %CYGWIN_HOME%\bin
copy %CYGWIN_HOME%\bin\genosimage.exe %SOURCE_HOME%\mkisofs
|
...
In Eclipse,
Code Block |
---|
Window -> PreferencesPreferences -> XML -> Editor -> select "Indent using spaces", also set "Indentation size 2 spaces" |
...
To debug POMs, read through the effective POM:
Code Block |
---|
$ mvn help:effective-pom
|
To see how the dependencies are related to the modules:
Code Block |
---|
$ mvn dependency:tree
|
As with anything, feel free to browse the documentation on maven: This guide is very helpfull.
...
2. Go into the deps directory and run install-non-oss.sh
Code Block |
---|
$ cd deps
$ mv cloud-manageontap.jar manageontap.jar
$ mv vmware-apputils.jar apputils.jar
$ mv vmware-vim.jar vim.jar
$ mv vmware-vim25.jar vim25_51.jar
$ unzip cloud-netscaler-jars.zip
$ ./install-non-oss.sh
|
...
Running the maven command in the top directory of the CloudStack sources will compile all sources for CloudStack. 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 (non-oss) libraries disabled. If you want to enable this, just add -D noredist to the mvn command line or see the table below for more fine-grained options. The install goal will compile all sources, make war and jar files and add them to your local repository.
The CloudStack build process uses maven profiles. The following table shows the more common profiles that are defined:
Available profiles | Enabled by property | Requires profiles | Description |
---|---|---|---|
deps |
|
| Enables a convenience download for all dependencies into the deps directory, usage mvn -P deps -pl deps install |
developer |
|
| Enables a convenience pom with developer functions |
vmware | noredist |
| Enables the build of vmware-base and the vmware plugin, requires vmware SDK to be present. See also Hypervisor VMWare. |
netapp | noredist |
| Enables the build of the netapp plugin, requires NetApp manageontap sdk. |
f5 | noredist |
| Enables the build of the f5 plugin, requires f5 iControl library |
netscaler | noredist |
| Enables the build of the netscaler plugin, requires additional libraries. |
srx | noredist |
| Enables the build of the juniper srx plugin, requires additional libraries. |
marvin | marvin.config | developer | Allows you to configure cloudstack using a marvin json configuration |
Available properties |
| Required profile | Description |
deploydb |
| developer | Clears and creates the cloud database in the mysql server configured utils/conf/db.properties |
noredist |
|
| Enables all modules that are not part of the standard ASF build |
systemvm |
| systemvm | Enabled the build of the systemvm.iso, requires mkisofs to be available on the commandline |
awsapi |
| awsapi | Enables building of awsapi module along with rest of the CloudStack |
simulator |
| developer | Enables the simulator spring context for running the integration test |
...
Note: The following is a WIP feature, use the old Ant command for a complete refresh. This command assumes you have a proper setup in utils/conf/db.properties and the cloud user already exists on your mysql database. If you have a root password, copy db.properties to db.properties.override and put your password there.
Code Block |
---|
$ mvn -P developer -pl developer -Ddeploydb
|
...
On can use maven to deploy and debug the management server. First export the MAVEN_OPTS variable to open a transport socket on port 8787 (same as before).
Code Block |
---|
$ export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=500m -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
|
...
This will run a jetty server on localhost port 8080 with the management server. Make sure that no other processes are using the port 8080. The default port for tomcat is 8080. You can either shut down tomcat service or switch to another port.
Code Block |
---|
$ mvn -pl :cloud-client-ui jetty:run
|
...
Note: The following is a WIP tomcat-plugin feature, use the above jetty command for now.
Code Block |
---|
$ mvn org.apache.tomcat.maven:tomcat7-maven-plugin:2.0:run -pl :cloud-client-ui -am -Pclient
|
...
Use package.sh to build packages for linux systems that use rpms, like RedHat, CentOS and fedora.
Code Block |
---|
$ cd packaging/centos63
$ ./package.sh
|
On Master:
Code Block |
---|
$ mvn install -P deps && dpkg-buildpackage
|
...
WIP: Package using deb profile (feature under development uses jdeb plugin, in https://github.com/bhaisaab/incubator-cloudstack/tree/debs-maven debs-maven branch):
Code Block |
---|
$ mvn package -P deb
|
...
Code Block |
---|
$ mvn --projects='org.apache.cloudstack:cloudstack' org.apache.rat:apache-rat-plugin:0.10:check
|
...
Code Block |
---|
$ mvn site
|
Update the version number of the project
Code Block |
---|
mvn release:update-versions -DautoVersionSubmodules=true -Dnoredist -Pdeps,developer -DdevelopmentVersion=<version>-SNAPSHOT
|
...
Set commandline parameter -o to force maven to only use the local repository. This might trigger build failures if artifacts are not available locally, but might speed up the build process in some cases.
Code Block |
---|
$ mvn -o
|
Code Block |
---|
// Bash
export MAVEN_OPTS=-Xmx512m
// Windows
set MAVEN_OPTS=-Xmx512m
|
...
Code Block |
---|
# mkdir -p /etc/cloudstack/management/
# cp ./client/target/cloud-client-ui-4.3.0-SNAPSHOT/WEB-INF/classes/db.properties /etc/cloudstack/management/
# ./client/target/generated-webapp/WEB-INF/classes/scripts/storage/secondary/cloud-install-sys-tmplt -m /mnt/secondary -u http://jenkins.buildacloud.org/view/master/job/build-systemvm-master/lastSuccessfulBuild/artifact/tools/appliance/dist/systemvmtemplate-2013-11-14-master-xen.vhd.bz2 -h xenserver -F
|