Skip to content
Levi Starrett edited this page Mar 14, 2020 · 10 revisions

Jump Start

In this section, we will go start to finish on how to create, build, and run an xtUML project from scratch. This guide assumes some basic knowledge of how to use BridgePoint. For help with BridgePoint and xtUML, please visit xtUML.org.

Example projects

If you have not already, go to the examples page of the repository. That is a great place to start if you find yourself wanting to learn by viewing existing projects.

Dependencies

On Ubuntu linux:

sudo apt-get update && sudo apt-get install -y maven python-pip wget unzip
pip install pyxtuml
wget https://s3.amazonaws.com/xtuml-releases/nightly-build/org.xtuml.bp.product-linux.gtk.x86_64.zip
unzip org.xtuml.bp.product-linux.gtk.x86_64.zip

On macOS:

brew install maven wget unzip
pip install pyxtuml
wget https://s3.amazonaws.com/xtuml-releases/nightly-build/org.xtuml.bp.product-macosx.cocoa.x86_64.zip
unzip org.xtuml.bp.product-macosx.cocoa.x86_64.zip

Download the Ciera runtime library

Note
This step is not necessary if you have built a Ciera project before (including the examples). It simply downloads the runtime library (including modeled artifacts).

In a terminal window:

mvn -DgroupId=io.ciera -DartifactId=runtime -Dversion=2.1.0 dependency:get

Creating an xtUML project

  1. Open BridgePoint and create a new xtUML project. Call the project "MyCieraProject"

  2. Create a new package, component, package, and function in the project. Name them "system", "test", "functions", and "foo" respectively. Your tree should now look something like this:

    Project Tree
  3. Enable inter-project references. Right click on project > Properties > xtUML Project > Inter-project References.

  4. Import the Ciera runtime library. Import > General > Existing Projects into Workspace. Tick the "Select archive file" and navigate to ~/.m2/repository/io/ciera/runtime/2.1.0/runtime-2.1.0.jar. Select the runtime project and click "Finish".

  5. Open the "foo" function and enter the following code:

    LOG::LogInfo(message:"Hello, World!");
    control stop;

Setting up the Maven build

  1. Navigate to the Eclipse project location

  2. Create a directory called gen/

  3. Create a file called gen/features.mark with the following contents:

    *,ApplicationName
    *,ApplicationPackage
    *,AsyncApplication
    *,NonPersistentInstanceIds
    *,RootPackage
    *,SortComparator
    *,TemplateDir
    Association,Exclude
    Attribute,NonPersistent
    Component,EnableSimulatedTime
    Component,InitFunction
    Component,InstanceLoading
    Component,Version
    Model Class,Exclude
    Model Class,NonPersistent
    Model Class,UseKeyLettersForName
    Package,DoNotSerialize
    Port,BaseClass
    Port,HttpEndpoint
  4. Create a file called gen/application.mark with the following contents:

    *,RootPackage,*,MyCieraProject::system
    system::test,InitFunction,Component,foo
  5. Create a file called pom.xml with the following contents:

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>io.ciera</groupId>
      <artifactId>MyCieraProject</artifactId>
      <packaging>jar</packaging>
      <version>1.0.0-SNAPSHOT</version>
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
      </properties>
      <dependencies>
        <dependency>
          <groupId>io.ciera</groupId>
          <artifactId>runtime</artifactId>
          <version>2.1.0</version>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>io.ciera</groupId>
            <artifactId>ciera-maven-plugin</artifactId>
            <version>2.1.0</version>
            <executions>
              <execution>
                <id>pre-build</id>
                <goals>
                  <goal>pyxtuml-pre-build</goal>
                </goals>
              </execution>
              <execution>
                <id>ciera-core</id>
                <goals>
                  <goal>core</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
        <resources>
          <resource>
            <directory>${project.basedir}</directory>
            <filtering>true</filtering>
            <includes>
              <include>models/**/*.xtuml</include>
              <include>.project</include>
            </includes>
          </resource>
          <resource>
            <directory>${project.build.directory}/generated-sources/java</directory>
            <filtering>true</filtering>
            <includes>
              <include>**/*.properties</include>
            </includes>
          </resource>
        </resources>
      </build>
    </project>

Building the project

  1. In the project directory:

    mvn install

Running the project

  1. In a terminal:

    java -cp $HOME/.m2/repository/io/ciera/runtime/2.1.0/runtime-2.1.0.jar:$HOME/.m2/repository/io/ciera/MyCieraProject/1.0.0-SNAPSHOT/MyCieraProject-1.0.0-SNAPSHOT.jar mycieraproject.MyCieraProjectApplication

Congrats!

You’ve built and run your first Ciera project.

Clone this wiki locally