This tutorial takes you through the basic steps of creating and configuring a Java project in Netbeans and Maven for use with the SDK.
Open the New Project wizard by choosing File > New Project.
press Next and fill in the next wizard:
i.e., type a name for your application, e.g. aimmsapp, and press Finish.
Add a dependency on the SDK by first opening the pom.xml (located in the Projects Window, aimmsapp > Project Files > pom.xml):
Next select the properties and dependencies nodes in the xml file, and replace them by the text below:
(Notice the Java version of the SDK in the 3rd row. If this documentation did not come with the installation you are currently using, you might have to replace this with the correct version.)
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<AimmsSdkVersion>1.3.0.7</AimmsSdkVersion>
<slf4jVersion>1.6.1</slf4jVersion>
</properties>
<dependencies>
<dependency>
<groupId>com.aimms</groupId>
<artifactId>aimmssdk</artifactId>
<version>${AimmsSdkVersion}</version>
</dependency>
<!-- We like to use the log4j backend as backend for slf4j, you're
however free to chose your own slf4j backend-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4jVersion}</version>
</dependency>
</dependencies>
<repositories>
<!-- specify a local-disk repository for the AIMMS SDK pointed to by the
AIMMS_SDK_HOME environment variable (set during installation) -->
<repository>
<id>aimms-sdk</id>
<name>AIMMS SDK Repository</name>
<url>file://${AIMMS_SDK_HOME}/java</url>
</repository>
<!-- repositories below are used for obtaining the slf4j and log4j dependencies -->
<repository>
<id>com.springsource.repository.bundles.release</id>
<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/release</url>
</repository>
<repository>
<id>com.springsource.repository.bundles.external</id>
<name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/external</url>
</repository>
</repositories>
Optionally you can configure the log4j backend for
slf4j by adding a log4j.properties file to the src/main/resources folder. To do so, Open the New File wizard by choosing File > New File:
and select Other and Properties File followed by pressing Next. Complete the wizard by filling in the New Properties File form:
with File Name:
log4j
and Folder:
src\main\resources
on Windows or
src/main/resources
on Linux.
Finish by pasting the text below into the log4j.properties file:
# create a new appender named 'mylogger' with the following properties: # (see http://logging.apache.org/log4j/1.2/manual.html for more information) log4j.appender.mylogger=org.apache.log4j.ConsoleAppender log4j.appender.mylogger.layout=org.apache.log4j.PatternLayout log4j.appender.mylogger.layout.conversionPattern=%-5p - %t - %-26.26c{1} - %m\n # alternatively we could just disable logging by using the null appender #log4j.appender.mylogger=org.apache.log4j.varia.NullAppender # display error (and higher level) log messages from the aimmssdk log4j.logger.com.aimms=ERROR # all logging with level TRACE or higher should be redirected to our 'mylogger' logger log4j.rootLogger=TRACE, mylogger