When trying out the bundled Maven tool that now ships with GigaSpaces, I found it friendly to my sensibilities to create a couple of new scripts:
I placed both of these in the GS_HOME/tools/maven directory:
- The first one sets up the necessary paths before calling the installmavenrep.bat that comes with GigaSpaces:
mavensetup.cmd
set M2_HOME=%~dp0apache-maven-2.0.9
set PATH=%PATH%;%M2_HOME%\bin
call installmavenrep.bat
- The second one starts up a new shell with the paths set so that maven commands will function as expected by the GigaSpaces documentation:
mavenshell.cmd
set M2_HOME=%~dp0apache-maven-2.0.9
set GS_HOME=%~dp0..\..
set PATH=%PATH%;%M2_HOME%\bin;%GS_HOME%\bin
start “MAVEN SHELL”
Once in my “MAVEN SHELL”, I can create a new application that uses the mirror service by executing:
C:\gigaspaces-xap-6.6.0-m3\tools\maven>mvn os:create dashDgroupId=com.test.mirror dash
DartifactId=MyFirstMirrorApp dashDtemplate=basic-async-persistency
With the project created – and quickly too! I now add another script to the mix:
- This script lives in the root directory of the newly generated project.
In this example that would be the MyFirstMirrorApp directory found on my machine here:
C:\gigaspaces-xap-6.6.0-m3\tools\maven\MyFirstMirrorApp>
- The purpose of this script is to start up each of the aspects of the project in the proper order and demonstrate that it all works:
(Note: I execute this from within my “MAVEN SHELL” after CD‘ing into the MyFirstMirrorApp directory)
runmyproject.cmd
rem note you must setup mvn before trying to run this project in this way…
start mvn compile os:run dashDmodule=mirror
echo sleep
ping 1.1.1.1 -n 1 -w 60000 > NUL
start mvn compile os:run -Dcluster=“total_members=2,1” -Dmodule=processor
echo sleep
ping 1.1.1.1 -n 1 -w 60000 > NUL
start mvn compile os:run -Dmodule=feeder
Once everything is running, I can start the GigaSpaces management User Interface by executing: the following from within my “MAVEN SHELL“
>start gs-ui
Now comes the time for the final script of the day:
- I store this script in the tools/maven directory.
- This is once again executed from within the same “MAVEN SHELL” that I have been using up until now.
- This script starts up the HSQL Viewer and connects to the database being used by the mirror service to store data:
lookatmydb.cmd
mvn os:hsql-ui
dashDdriver=org.hsqldb.jdbcDriver
dashDurl=jdbc:hsqldb:hsql://localhost/testDB
executing the following query while in that viewer shows the data stored there :
select * from PUBLIC.DATA