Skip to content

Building JGrasstools and insert it in your project

Andrea Antonello edited this page Mar 10, 2017 · 1 revision

Get the source code

Get the source code from by cloning https://github.com/moovida/jgrasstools.git.

You should end up having a jgrasstools folder containing the folders of the subprojects:

  • apps
  • dbs
  • grass
  • gui
  • hortonmachine
  • jgrassgears
  • lesto
  • modules
  • oms3
  • server

Maven version

I have made my tests with:

Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_60, vendor: Oracle Corporation
Java home: /home/hydrologis/SOFTWARE/JAVA/JDKS/jdk1.8.0_60/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-62-generic", arch: "amd64", family: "unix"

How to build

The best way to build jgrasstools is from the root folder, in ordrer to make maven take care about the build order of the various projects.

So enter the root folder and issue the command:

mvn install

if the release is not stable, tests may fail to pass, so you might want to build with:

mvn install -Dmaven.test.skip=true

That will build the project, execute the tests and install the resulting jar into the local repository of the user (usually *~/.m2*).

Should there be some strange error in building from the root folder, then try by running first:

mvn install -N

and only then the build as explained before.

How to build the projects for development in your ide

Eclipse

If you are an eclipse user, just run:

mvn eclipse:eclipse

from the root folder of jgrasstools. This will create the eclipse projects that can then be imported into eclipse through:

File  -> Import -> General -> Existing Projects into Workspace

Netbeans

Netbeans should by default be able to recognize the maven project structure, so you should be able to import the project easily.

(If a netbeans user would be so kind to send me instructions, I will be glad to add them here)

Maven quickstart

To get started with maven you could visit the maven quickstart guide.

Integration in your own project

You can use JGrasstools inside your code the plain java way as a library.

To help you getting started, we created a small maven project with a couple of examples that make use of JGrasstools as a library.

The examples lives in the code repository. Just check it out and modify it to your needs.