This section provides a step-by-step guide to set up your development environment for AndroMDA. We assume that you are working on a Windows platform. Throughout this section you will install various programs. The recommended installation paths for these programs and other required directories are listed below. Please feel free to change the installation paths depending on your configuration and personal preferences. For example, you may choose to install programs on the D: drive instead of the C: drive. However, note that some programs don't work well if there are spaces in their pathname. So, try to stick to the suggestions below as much as possible.
Recommended Path | Purpose |
---|---|
C:\Programs\m2repo | Maven local repository M2_REPO |
C:\Programs\maven3 | Maven3 program M2_HOME |
C:\Programs\Java\jdk\6 | Java Development Kit JAVA_HOME |
C:\Programs\Java\jdk\6\jre6 | Java Runtime Engine |
C:\Programs\MySQL | MySQL database server 5.6 |
C:\Programs\JetBrains\IntelliJ IDEA 9.0.2 | IntelliJ IDEA IDE (optional) |
C:\Programs\Eclipse | Eclipse IDE (optional) |
C:\Programs\JBoss\7 | JBoss v7 Application Server JBOSS_HOME |
You will also be asked to set up several environment variables. Please set these as SYSTEM variables using the Control Panel (Control Panel > System > Advanced > Environment Variables, or Computer > Properties > Advanced > Environment Variables). Note that if you change the installation path of any program then you must make sure that the associated environment variable is changed accordingly.
Install J2SE Development Kit 6 (JDK 6) or newer from http://www.oracle.com/technetwork/java/javase/downloads/index.html. This is the preferred version of the JDK for AndroMDA. We also support JDK version 1.5. Support for version 1.4 requires a specific code generation configuration overriding the default settings, and changing to an earlier maven version and changing compiler settings.
Make sure that the JAVA_HOME environment variable is pointing to the directory where you installed the JDK. It is possible you have this variable set already, but just to make sure here's how to check.
Maven3 is our preferred tool for building and deploying applications generated by AndroMDA. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting, and documentation from a central piece of information. If you are familiar with Ant, Maven is very similar except that it contains additional functionality:
Install Maven 3.0.3 by following the steps below.
Note: If you are behind a proxy server, you will have to configure Maven to use the proxy. The details can be found below. Maven 2.2.1 or later will also work with AndroMDA.
JBoss Application Server is a widely used open source Java application server. Install JBoss 7 by following the steps below.
We have seen earlier how to set environment variables such as JAVA_HOME, it is strongly recommended to set the following variables before continuing. We repeat JAVA_HOME here just for completeness.
Property | Value | Required? |
---|---|---|
JAVA_HOME | Java installation directory, e.g. C:\Programs\Java\jdk\6 | Yes |
M2_HOME | Maven installation directory, e.g. C:\Programs\maven3 (this may have already been set by the Maven installer) | Yes |
M2_REPO | Maven local repository, e.g. C:\Programs\m2repo | Yes |
MAVEN_OPTS | Parameters to pass to the Java VM when running Maven. Set this value to: -XX:MaxPermSize=128m -Xmx512m (required to build large maven projects such as AndroMDA itself) | No |
JBOSS_HOME | JBoss installation directory, if running jboss server e.g. C:\Programs\JBoss\7 | No |
ANT_HOME | Ant installation directory, if running ant scripts from maven e.g. C:\Programs\Ant. Can set to eclipse\plugins\org.apache.ant directory. | No |
PATH | This makes sure the system will search for console commands in the directories listed here. If this property already exists you should simply add %JAVA_HOME%\bin;%M2_HOME%\bin;%ANT_HOME%\bin | Yes |
Maven is based on the concept of a single local repository located on your machine, where it automatically downloads artifacts such as 3rd party libraries as well as components created by you. When you create a new project, you must specify a Project Object Model (POM) in a file named pom.xml. In this file, you can tell Maven about the various 3rd party libraries and components your application depends on. When Maven starts to build the application, it will first fetch these dependencies from one or more remote repositories (generally located on the Internet) and store them in your local repository. This allows future builds to happen entirely locally. By default, the local repository is located at C:\Documents and Settings\your user name\.m2\repository. Note that so far we have installed only the Maven application, we have not created a local repository. Follow the steps below to test your Maven installation and force the creation of a local repository. We will use a standard Maven plugin to create a temporary project which we will delete later. Maven3 and Maven2 share the same M2 environment variables.
... <!-- localRepository | The path to the local repository maven will use to store artifacts. Always set to M2_REPO environment variable. | | Default: ~/.m2/repository | Note: This value overrides the M2_REPO environment variable, if different! --> <localRepository>${env.M2_REPO}</localRepository> ... <!-- pluginGroups | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e. | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list. |--> <pluginGroups> <!-- Specifies a further group identifier to use for plugin lookup. Causes all to be searched for updates.--> <pluginGroup>org.andromda.maven.plugins</pluginGroup> </pluginGroups> ... <!-- proxies | This is a list of proxies which can be used on this machine to connect to the network. | Unless otherwise specified (by system property or command-line switch), the first proxy | specification in this list marked as active will be used. |--> <proxies> <!-- proxy | Specification for one proxy, to be used in connecting to the network. | --> <proxy> <id>your-proxy</id> <active>true</active> <protocol>http</protocol> <host>your-proxy.company.com</host> <port>8080</port> <nonProxyHosts>*.company.com|127.0.0.1|localhost</nonProxyHosts> </proxy> </proxies> ... <repositories> <repository> <id>sonatype</id> <name>Sonatype Repository</name> <url>http://oss.sonatype.org/content/groups/public</url> <snapshots> <enabled>true</enabled> </snapshots> </repository> <repository> <id>jboss</id> <name>JBoss Repository</name> <url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>sonatype</id> <name>Sonatype Repository</name> <url>http://oss.sonatype.org/content/groups/public</url> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories> ...
Apache Maven 3.0.3 (r1075438; 2011-02-28 12:31:09-0500) Java version: 1.6.0_21 Java home: C:\Program Files\JDK\16\jre
mvn archetype:create -DgroupId=testapp -DartifactId=testapp
Next we will download and install the AndroMDA Application plugin. This plugin allows creation of Java starter applications that use AndroMDA. All artifacts, such as AndroMDA cartridges, will be automatically downloaded by the Maven scripts generated by the plugin.
... <build> <defaultGoal>compile</defaultGoal> <plugins> <plugin> <groupId>org.andromda.maven.plugins</groupId> <artifactId>andromdapp-maven-plugin</artifactId> <version>3.5-SNAPSHOT</version> </plugin> </plugins> </build>
Install a tool that will allow you to model your applications in UML and export these models into a format that AndroMDA can understand. AndroMDA currently supports UML 1.4/XMI 1.2 as well as UML2 3.x/EMF/XMI2. Please follow one of the links below to install the UML tool of your choice. (We invite UML tool vendors and open-source projects to test their tools with AndroMDA and supply installation instructions for inclusion in this section.)
ArgoUML (UML 1.4/XMI 1.2)
MagicDraw 9.5 (UML 1.4/XMI 1.2)
MagicDraw 11.5 through 17 (EMF-UML2 3.x)
RSM 7, 7.5, 8 (Rational Software Modeler/Architect) (EMF-UML2 3.x)
Eclipse Papyrus (EMF-UML2 3.x)
Install or download a database that is supported by Hibernate. Click http://www.hibernate.org/260.html to see the list of supported databases. For the purpose of this tutorial we assume that the H2 database will be downloaded automatically and configured by maven as part of the build process. If you have installed another database then you will have to change the AndroMDA Hibernate configuration accordingly in the completed application pom.xml.
Eclipse is a popular open source IDE that is useful in developing Java applications. AndroMDA does not require the use of Eclipse. However we do recommend using it for development as it helps increase your productivity. Eclipse users will glad to know that AndroMDA generates fully usable .project and .classpath files, or you can use the Sonatype M2E Eclipse plugin to manage your maven projects. You can download Eclipse from http://www.eclipse.org/downloads. We recommend downloading the Eclipse Indigo (v3.7) Package called "Eclipse IDE for Java EE Developers". Follow the steps below to install and configure Eclipse:
-vmargs -Xms256m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=256m
Now that the development environment is set up, we are ready to try out the TimeTracker application. Click here to get started.