AgE 2.4 : Running sample applications

Before running the sample applications you should familiarize yourself with the Installation of jAgE Platform

All the sample applications are in the svn repository at the address: https://caribou.iisg.agh.edu.pl/svn/age/jage/trunk/examples/ (or anonymous access: http://caribou.iisg.agh.edu.pl/pub/svn/age/jage/trunk/examples).

You have to download the whole examples directory.

On this page:

Run examples from Eclipse

  1. First of all, you have to import projects to Eclipse. To achieve this goal, it is required to generate files .project and .classpath by executing the following command in the main directory (examples):
    mvn eclipse:eclipse
    Connection to the Internet is needed
  2. Now you have to import the projects to Eclipse (File -> Import -> Existing project into Workspace) - it is necessary to import both the generated projects (solutions and applications).
  3. To run the sample applications you have to move to the directory src/main/config in the project applications - there are run configurations for all of the examples. To run any of them, right-click on one of the configurations and choose Run As and the configurations's name.

Run examples from command line (using Maven)

  1. Firstly, it is necessary to compile the source files by executing the following command in the main directory (examples):
    mvn compile
    Connection to the Internet is needed, to download all required dependencies.
  2. Then you have to navigate to the directory examples/applications-examples.
  3. You can run examples using the following Maven command:
    mvn exec:java -Dage.node.conf=uri_of_config_file
    Configuration files for examples can be found in the directory examples/applications-examples/src/main/resources/examples/.
    For example:
    mvn exec:java -Dage.node.conf=file:src/main/resources/examples/helloworld/age.xml
    Or, if you prefer loading files from the classpath:
    mvn exec:java -Dage.node.conf=classpath:examples/helloworld/age.xml

You can also run your own AgE applications using the same Maven command:

mvn exec:java -Dage.node.conf=uri_of_configuration_file

This method can be used also to run your own application. You only need to assure if the following configuration is in your project's pom file (or the parent ones):

<build>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>exec-maven-plugin</artifactId>
      <version>1.2</version>

      <configuration>
        <mainClass>org.jage.platform.node.NodeBootstrapper</mainClass>
        <arguments>
          <argument>-starter</argument>
          <argument>org.jage.platform.starter.batch.single.BatchModeSingleStarter</argument>
          <argument>-Dage.node.conf=${age.node.conf}</argument>
        </arguments>
      </configuration>
    </plugin>
  </plugins>
</build>