Skip to content

Dev, Multiproject Definition

Paolo Ciccarese edited this page Jan 16, 2015 · 10 revisions

Cloning the code base

When cloning the codebase for the development environment of dpf-java-core it might be helpful to have in the same workspace also the dependency json-dp-java.

On Unix like systems, you can start by creating a script such as clone.sh:

#!/bin/sh
# Cloning json-dp-java
echo " Cloning json-dp-java"
echo "-------------------"
git clone https://github.com/json-dp/json-dp-java.git
# Cloning dpf-java-core
echo " Cloning dpf-java-core"
echo "-------------------"
git clone https://github.com/dpf-java/dpf-java-core.git

By executing the above script you will clone the necessary repository in your desired folder. Alternatively you can just copy and paste the git clone commands in the command line.

Gradle Multiproject Definitions

The files hierarchy will look like

MyFolder
 |-/json-dp-java 
 |-/dpf-java-core
 |-/settings.gradle
 |-/build.gradle

In the file settings.gradle:

include 'json-dp-java'
include 'dpf-java-core'

In the file build.gradle:

project(':json-dp-java') {
    apply plugin: 'java'
    
    group = 'json-dp-java'
    version = 1.0
    
    repositories {
        mavenCentral()
    }

    dependencies {
        compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
        compile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.9'
        testCompile group: 'junit', name: 'junit', version: '4.+'
    }
}

project(':dpf-java-core') {
    apply plugin: 'java'
    apply plugin: 'eclipse'
    
    group = 'dpf-java'
    version = 1.0
     
    repositories {
        mavenCentral()
    }

    dependencies {
        compile project (':json-dp-java')
        compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
        compile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.9'
        testCompile group: 'junit', name: 'junit', version: '4.+'
    }
}

Setting up Eclipse

Once you performed the above steps you are ready to set up the projects for the Eclipse IDE. To do so:

MyFolder$ gradle eclipse

Now the projects should be ready and you can, for instance, open Eclipse specifying MyFolder as workspace. Then you can 'import existing projects' and, by selecting once again the MyFolder, Eclipse will detect the two projects that can be imported.

Clone this wiki locally