Versions Compared

Key

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

...

Eclipse will import the projects and build the code. At this point you should be able to develop and debug code as usual within Eclipse.

Bonus Track: Running CloudStack Through Eclipse

One bonus of the The Maven integration is makes it is now reasonably easy to run and debug the CloudStack UI through Eclipse. When using one of the launch configurations below and start them a a debug configuration you can immediately use any breakpoints set in the Eclipse UI.

For easy building and launching you can setup several run configurations (Located at Menu Run -> Run Configurations...):

through Eclipse. Basically, you can add the 'mvn' command-line calls to your Eclipse Workspace be defining corresponding Run Configurations.

The Maven commands we want to add as Run Configurations are discussed in detail on the Building with Maven page. The steps we want to add can be summarised as

  1. Clean (remove previous versions of source).
  2. Install (build new version of source)
  3. Database Setup (deploy a database with default settings, e.g. default password)
  4. Launch server in Jetty (Jetty is an alternative to Tomcat suited to debugging)

Now, we could have combined steps 1 & 2 above, but splitting them allows incremental compilation. In contrast, combining them will make for a very slow build.  Also, you only need to setup the database once after doing a Clean.

Creating a Run Configuration

For each Run Configuration to be added:

  1. From menu bar, select Run -> Run Configurations...
  2. Double click on Maven Build.  This will create a Maven run configuration with the name New_configuration
  3. Update the Name to something corresponding to what happens in the step, and set Base Directory to $project_loc:cloudstack (This tells Eclipse that the base directory for execution is the folder with a _pom.xml_ that has an <artifactId> with the value cloudstack)
  4. From each mvn command, place the -P argument in the Profiles: textbox, Add... any parameters expressed as key=value , and place the remainder of the command in the Goals: textbox.

Maven will download everything needed to run CloudStack with Jetty, build the code, and run the UI. You can connect to it via http://localhost:8080/client.

The following commands were correct at the time of writing.  If they don't work, double check the Building with Maven|../../../../../../../../../display/CLOUDSTACK/Building+with+Maven||\ 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:cloudstackCloudStack rebuild (full rebuild of cloudstack code)
Base directory: ${project_loc:cloudstack}
Goals: clean install
Profiles: <empty>CloudStack launch (launch the jetty based management server)
Base directory: ${project

...

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

...

Code Block

 mvn -P developer -pl developer -Ddeploydb=true

Base directory: $project_loc:cloudstack}
Goals: -pl client jetty:run
Profiles: <empty>developer
Profiles: developer
Parameter Name: deploydb=true

...

Jetty-based launch (of management server)

...

Code Block

 mvn -pl client jetty:run

Base directory: $projectCloudStack launch (launch the jetty based awsapi server)
Base directory: ${project_loc:cloudstack}
Goals: -pl awsapi client jetty:run
Profiles: <empty>CloudStack rebuild (full rebuild of cloudstack code)

...

(Optional) launch the jetty based awsapi server:

...

Code Block

 mvn -pl awsapi jetty:run

Base directory: ${project$project_loc:cloudstack}
Goals: -pl developerawsapi jetty:run
Profiles: developer
Parameters: deploydb = trueMaven will download everything needed to run CloudStack with Jetty, build the code, and run the UI. You can connect to it via http://localhost:8080/client. <empty>