How-to setup your SAP Business Objects Event Insight
development environment in three easy steps.
We all know the general rule – If you type something twice
you already missed the first chance to write a script for it. The same is true
if you ever tried to create an Event Insight Java project. But of course there
is a workaround that allows you to use the mighty powers of Maven to create a
simple but powerful built environment.
This is a step-by-step guide that leads you to a compiling,
working, and running SAP Business Object Event Producer using the powers of Maven.
Step 1 – Downloads
[http://Maven.apache.org/download.html | http://maven.apache.org/download.html]
While your download is happening let me give you some
background and pointers: Maven is a build manager for Java projects. Project
descriptions and certain built goals are all described in pom.xml files. Maven
is able to download pre-build components that are referenced in the pom.xml
from external build repositories. In our example we will primarily focus on
local references instead of repository references.
Unzip Maven to a location of your choice: Make sure to
create an environment variable called M2_HOME pointing to your Maven root
location (in my case:
d:\MyDocuments\Tools\apache-Maven-3.0.2\
). Also create a variable called
M2
set to
%M2_HOME%\bin
.
I recommend adding M2 to the PATH as well, once you understand Maven you will
be addicted to it – trust me.
But of course there is more to do:
First of all Maven requires you to have a Java JDK - you
will need to download the Java 1.6 JDK from Oracle (yes folks – SUN was acquired
Oracle): http://www.oracle.com/technetwork/Java/Javase/downloads/index.html
Also this tutorial focuses on how you can use Maven in Eclipse
to build components for Event Insight – thus you obviously need Eclipse to follow
along. Obviously Maven does not require Eclipse and the pom.xml files will work
without Eclipse – but it is just so much more graphic when using Eclipse.
So let’s download it (I usually go for the
plugin-development version, but since we will be using Maven to built it is not
required): http://www.Eclipse.org/downloads/ To create a nice and tight integration between Maven and Eclipse
you can pick your favorite from a selection of readily available plugins. My
personal preference lies with the sonatype m2 plugin. Which you can install
from within Eclipse (just follow the instructions published here: http://m2Eclipse.sonatype.org/installing-m2Eclipse.html
Or if you are more the visual type check out this video and
follow along: http://www.youtube.com/watch?v=1yOwMBYSq2A
After a restart of Eclipse
you are good to actually get rolling.
*Step 3 - Getting on
the way*
In Eclipse quickly create a new Maven project using the “create-new-project-wizard”.
Make sure you select New -> Project… -> Maven ->Maven Project.
Otherwise you will end up mannualy changing the nature of a project afterwards –
which is possible but can cause surprising side-effects.
The next screen is really confusing – it offers a selection
of templates (archetypes) on how to build certain types Maven project – unfortunately
there is no way for you to find out what each one of these archetypes do – at least
not on the screen – you can either google or bing them one by one or just trust
me on this an d select the archetype “Maven-archetype-quickstart” which creates
an empty Maven configuration (in all honesty – this is the only archetype I
ever used here). For this example we are using corp.sap.pal.img as a the
package and group identifier and “WebInterface” as the Artefact Id. I know you
are excited about going your own way… but let’s just stay on the beaten path
for a second (or maybe more realistically half an hour :wink: ).Please note that the Event Insight team at this point can
only provide support for SAP developed adapters. If you run into any issues on
this – join code exchange and the community and I will do the best we can to
help you. The code exchange project which also contains source samples and the
pom.xml file mentioned in this post is located here: https://cw.sdn.sap.com/cw/groups/event-insight-advanced-producers-and-consumers
Hope to see you there.