Installation and Generation of the FuGE XSD
What follows
are the installation instructions for this STK. If followed correctly, you
will have successfully generated the plain FuGE XSD, without any extra
modifications or community extensions. If successful, you can then move on to
creating your own community extension.
This FuGE toolkit can be installed on either Windows or Linux, and it may
work on Mac systems, though it hasn't been tested.
These instructions are based on
http://wiki.ficcs.org/ficcs/FuGE-to-XSD
and
the
Andromda Forums
, with further additions and modifications to suit this toolkit.
Download and Installation of Required Software
Please
read through this section and ensure that you either install the missing
software, or double-check that you already have the correct version of the
software installed.
Java
- Install J2SE Development Kit 5.0 (JDK 5.0) or higher from
http://java.sun.com/j2se/1.5.0/download.jsp
or similar.
- Make sure that the JAVA_HOME
environment variable is pointing to the directory where you installed the
JDK.
Maven2
- Download and install Maven 2.0.7 or later from
http://maven.apache.org/download.html
- Maven2 Setup.
Create a directory in your home directory called .m2
with a single file inside called settings.xml
. This is what one possible settings.xml
looks like, where the local maven repository is in a different directory from
the settings.xml
file, and where there needs to be a proxy set up to connect to the outside
world:
<settings>
<localRepository>/media/share/synched/Documents/.m2/repository/</localRepository>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host><a href="http://wwwcache.ncl.ac.uk/" target="_blank">my.proxy.host</a></host>
<port>8080</port>
</proxy>
</proxies>
</settings>
All sections are optional. However, depending on your circumstances, you
may wish to use one or more of these settings. The "localRepository"
element names a location separate from the default home directory for the
Maven2 repository. This may be beneficial if you have limited space on your
home directory, as this repository directory can grow quite large. The
"proxies" element should only be used for those developers who must
access the internet via a proxy.
- Environment Variables and Settings for Maven
. Set up the environment variable M2_HOME to point to your maven installation
directory, and then ensure that both $M2_HOME/bin and $JAVA_HOME/bin are
present in your PATH. It is also useful, but not required, to specify
$M2_REPO, which is the location of your Maven2 repository.
- Test Maven2 (Part One).
You'll know if you've gotten this right if, when you run mvn --version, you
something similar (but not necessarily identical) to the following:
$ mvn --version
Maven version: 2.0.7
Java version: 1.5.0_08
OS name: "linux" version: "2.6.17-12-386" arch: "i386"
- Test Maven2 (Part Two).
Check that Maven2 is working properly by creating a temporary, empty project
with the following command:
mvn archetype:create -DgroupId=testapp -DartifactId=testapp
Check for the BUILD SUCCESSFUL
message and, once you have received this message, please delete the created
testapp
folder.
AndroMDA
This is the only AndroMDA artifact that we will install explicitly. All
other artifacts, such as AndroMDA cartridges, will be automatically downloaded
by the Maven2 scripts generated by the plugin. Install the plugin by following
the steps below.
- Go to
http://team.andromda.org/maven2/org/andromda/maven/plugins/andromdapp-maven-plugin/3.2/andromdapp-maven-plugin-install-3.2.zip
to download the the AndroMDA plugin installer.
- Unzip the contents of the installer into your Maven repository at
$M2_REPO (or whatever you have set "localRepository" to be, or by
default, it resides in your-home-dir/.m2/repository).
- Verify that the following directory was created (switch the slashes
around for Windows):
$M2_REPO/org/andromda/maven/plugins/andromdapp-maven-plugin
- Create a temporary directory, e.g. C:\andromda-temp
or $HOME/andromda-temp
.
- Create a file called pom.xml
in this directory with the following content:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>samples.test</groupId>
<artifactId>test</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>test</name>
<build>
<defaultGoal>compile</defaultGoal>
<plugins>
<plugin>
<groupId>org.andromda.maven.plugins</groupId>
<artifactId>andromdapp-maven-plugin</artifactId>
<version>3.2</version>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>andromda</id>
<name>AndroMDA Repository</name>
<url>http://team.andromda.org/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>andromda</id>
<name>AndroMDA Repository</name>
<url>http://team.andromda.org/maven2</url>
</pluginRepository>
</pluginRepositories></project>
- Open a Command Prompt in the directory where you created this pom.xml
and run the command mvn
without any arguments. Make sure the command completes successfully by
displaying the BUILD SUCCESSFUL
message.
- You can now delete the temporary directory you just created.
Checkout from Subversion
- Instructions for
Subversion checkout
are available on the Source
Repository
help page.
Compilation and Creation of the XSD
Extra Step for the
First Time You Compile
- Change into the top-level trunk/ directory, and run this
command:
- Though this is exactly the command you will use later on to generate
the XSD and the JAXB2 Java code, this needs to be run once to download the
required AndroMDA profiles. These profiles are *.xml.zip files that are
neccessary for correctly using MagicDraw. Before you can fix the bug in the
AndroMDA plugin mentioned in the next section, you need to download the
AndroMDA plugin itself. This first mvn install command will do that for
you.
Fixing a Bug in the AndroMDA plugin
When you downloaded and installed the AndroMDA plugin for Maven 2, there
was a small bug in one of the jars. (Details of this bug can be found on the
AndroMDA
forum
, and thanks to Olga Tchuvatkina for including the instructions for fixing
it.)
Without this fix, the XSDs generated will be virtually empty, containing
only the top-level namespace information.
- Go
into the top-level directory (directly underneath the trunk/ directory) of the
XSD STK you've just downloaded. You'll find a file called
andromda-xmlschema-cartridge-3.2.jar
there.
- Copy
this into the correct part of your Maven 2 Repository. Below the environment
variable $M2_REPO
is used to mark the location of your local Maven 2 Repository. Overwrite the
default jar file with the fixed one:
cp andromda-xmlschema-cartridge-3.2.jar $M2_REPO/org/andromda/cartridges/andromda-xmlschema-cartridge/3.2/
Generate all of the automatically-generated AndroMDA sources
Change into the top-level trunk/ directory, and run this command:
You should see a "BUILD SUCCESSFUL" message at the end of it.
You must be connected to the internet for this step to work the first time
you run it, as there will be many jars that need to be downloaded.
Further AndroMDA-specific maven commands are available in the
trunk/readme.txt
generated by AndroMDA.
- You now have all auto-generated code. This includes
- the XSD, found in
fuge-jaxb2/src/main/resources/xmlSchema.xsd
. The XSD needs to be directly written into the fuge-jaxb2 directory so that
the JAXB2 plugin can access it.
- the JAXB2 code that fits with the XSD, present both as Java classes
fuge-jaxb2/target and as a jar copied into your local maven repository.
Preparing Your UML Tool
You will need a UML tool.
AndroMDA has been tested with both
ArgoUML
0.20
and
MagicDraw 15.0
. However,
MagicDraw 15.0 is the recommend UML Editor for the FuGE toolkits. You can
download the Community Edition for free, if you are an academic.
- Open up MagicDraw 15.0. Before
you open any of the FuGE mdzip files, you need to set the
maven2.repository
path variable. This is equivalent to the $M2_REPO
environment variable you will have already set when installing maven. It
points to the location of the andromda 3.2 profiles, which are inside the
maven repository. This value should be wherever you have your maven
repository: if you installed Maven2 using the default repository location,
then maven2.repository
would be $HOME/.m2/repository for linux, or the equivalent in windows.
- If you are having problems, you can manually copy all of the andromda
profiles from the maven repository ($M2_REPO/org/andromda/profiles
) into the same directory as the model file, or into the profiles/
directory of the MagicDraw installation location.
- Test that your setup works after setting this variable by opening
trunk/src/mda/src/main/uml/FuGE-v1-profile.mdzip
. If it loads without error, you MagicDraw installation is complete.
Integration of SyMBA with your favourite IDE
You can
auto-generate Java IDE project files using maven2. For example, to
autogenerate IntelliJ files (please do this after
successfully running mvn install
) change directory to the top-level directory and run the following
command:
There are other similar commands for IDEs such as Eclipse. Details can be
found on the Maven
website.