Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

As part of switching to Apache Maven for building CloudStack, the .classpath and .project files used by Eclipse were removed. This page describes how to get CloudStack loaded into an Eclipse workspace. For more details on the actual build process with maven see How to build on master branchCloudStack. A modern appliance based CloudStack development can be explored with MonkeyBox.

Use a Recent Eclipse Build

...

Download the CloudStack source code via git with:

Code Block

git clone git clone https://git-wip-usgitbox.apache.org/repos/asf/cloudstack.git

...

CloudStack is a big project and it requires more memory for Eclipse.  Here's how to give it more memory.

  • Wiki Markupcd \ [eclipse home\]
  • vi eclipse.ini
  • Change or add the following properties
    • -Xms1024m
    • -Xmx2048m
    • -XX:PermSize=512m
    • -XX:MaxPermSize=1024M

...

  • Right click on the project and select Properties.
  • Go to Resource->Resource Filters.
  • Click on Add...
  • Select Exclude all
  • Select Folders
  • Click Regular Expression
  • Wiki MarkupIn the entry box, type \type [a-zA-Z0-9\].\*
  • Click OK
  • Click OK

What this does is to tell Eclipse that the sub-directories under parent projects should not be included in the resource list, thus avoiding the the duplicate resources in the Open Resource dialogue box.  If the parent project does have a directory that you want, then you can add that to a include filter.  Note that you can not use * as the folders because that would exclude the .settings folder which eclipse uses to keep its metadata and will cause the m2e plugin to have problems.

Here's a list of parent projects you should do this with:

  • cloudstack
  • cloudstack-framework
  • cloudstack-pluginscloud-services
  • cloudstack-frameworkservices
  • cloud-enginecloudstack-plugins
Avoiding conflicts between builds outside of Eclipse and Eclipse's auto-building

...

  • Exit Eclipse (assuming you've already installed the m2e plugin)
  • Wiki Markupcd \cd [cloudstack home\]
  • bash -x tools/eclipse/set-eclipse-profile.sh
  • Restart Eclipse

Upgrading Java

CloudStack has requirement for a newer 1.7 JDK, the default on my Mac was 1.6. You need to download the latest JDK from Oracle JDK Download.

The installation on my Mac was not in the default location: /System/Library/Java/JavaVirtualMachines but in location: /Library/Java/JavaVirtualMachines/.

You can have multiple JRE/JDKs installed on your system, you need to add the path to the new JDK to Eclipse Preferences>Java>Installed JREs

 For my JDK, the exact path I programmed was:  /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home. Your path may be different depending on the current JDK version.

Bonus Track: Running CloudStack Through Eclipse

...

The Maven commands we want to add as Run Configurations are discussed in detail on the How to build on master branchCloudStack page. The steps we want to add can be summarised as

...

The following commands were correct at the time of writing.  If they don't work, double check the How to build on master branchCloudStack page, and if you have any compassion update this section of the wiki.

Clean:
Code Block

 mvn clean

Base directory: $project_loc:cloudstack
Goals: clean install
Profiles: <empty>

Install (i.e. build):
Code Block

 mvn install

Base directory: $project_loc:cloudstack
Goals: clean install
Profiles: <empty>

Deploy Database (do once after a 'Clean'): mvn install:
Code Block

 mvn -P developer -pl developer -Ddeploydb=true

...

Jetty-based launch (of management server)
Code Block

 mvn -pl client jetty:run

Base directory: $project_loc:/cloud-client-ui
Goals: jetty:run
Profiles: <empty>

(Optional) launch the jetty based awsapi server:
Code Block

 mvn -pl awsapi jetty:run

Base directory: $project_loc:cloudstack
Goals: -pl awsapi jetty:run
Profiles: <empty>

...