0

I have the following structure :

Folder 'MyProject'

------ Root Project 'MyProject_gradle'                                                                                                      
------ Subproject 'MyProject_library'                                                                                                      
------ Subproject 'MyProject_game'                                                                                                      
------ Sub Root Project 'jme3'                                                                                                      
------ ------ Subproject 'jme3-core'                                                                                                      
------ ------ Subproject 'jme3-lwjgl3'                                                                                                      

The root project includes correctly both subprojects. However, when I include the sub root project 'jme3', it is included as normal subproject. In other words, the subsubprojects aren't loaded because the settings.gradle from the jme3 sub root project isn't loaded.

What I want : including 'jme3' should also include its subprojects and apply its settings only to its subprojects.

MyProject_gradle/build.gradle:

allprojects {
    project.ext {
        retroFlashyRPG = [
                basicName : 'RetroFlashyRPG_',
                prototypeName : 'RetroFlashyRPG_Prototype_'
        ]
    }
}

subprojects {
    apply plugin: 'java'
    apply plugin: 'idea'

    group = 'com.chevreuilgames'

    sourceCompatibility = 1.9
    targetCompatibility = 1.9

    repositories {
        mavenCentral()
        jcenter()

        maven {
            url "https://dl.bintray.com/stephengold/org.jmonkeyengine/"
        }
    }

    project.ext {
        jme = [
                group : 'org.jmonkeyengine',
                version : '3.1.0-stable'
        ]
    }
} 

MyProject_gradle/settings.gradle:

def RetroFlashyRPG = "RetroFlashyRPG_" // This is MyProject in this post's example
def RetroFlashyRPG_Prototype = RetroFlashyRPG + "Prototype_"

include 'prototype-library'
include 'jme3'

project(":prototype-library").projectDir = new File(settingsDir, "../${RetroFlashyRPG_Prototype}Library")
project(":jme3").projectDir = new File(settingsDir, "../${RetroFlashyRPG_Prototype}jmonkeyengine")

MyProject_jme3/settings.gradle:

/**
 * This is the global settings file used by all subprojects.
 **/
rootProject.name = 'jmonkeyengine'

// Core classes, should work on all java platforms
include 'jme3-core'
include 'jme3-effects'
include 'jme3-networking'
include 'jme3-plugins'
include 'jme3-terrain'

// Desktop dependent java classes
include 'jme3-desktop'
include 'jme3-blender'
include 'jme3-jogl'
include 'jme3-lwjgl'
include 'jme3-lwjgl3'

// Other external dependencies
include 'jme3-jbullet'
include 'jme3-niftygui'
include 'jme3-jogg'
include 'jme3-android'
include 'jme3-ios'

//native builds
include 'jme3-bullet' //java
include 'jme3-bullet-native' //cpp
include 'jme3-bullet-native-android' //cpp
include 'jme3-android-native' //cpp

// Test Data project
include 'jme3-testdata'

// Example projects
include 'jme3-examples'

if(buildAndroidExamples == "true"){
    include 'jme3-android-examples'
}
chenrui
  • 8,910
  • 3
  • 33
  • 43
Benoît Dubreuil
  • 650
  • 1
  • 11
  • 27
  • Post the relevant build and settings files. – user1803551 Dec 14 '17 at 19:12
  • A build can only have one `settings.gradle`, so you may have to refactor your `settings.gradle` and `build.gradle`. Some link ref: https://stackoverflow.com/questions/13595610/gradle-nested-multi-projects-with-project-compile-dependencies – chenrui Dec 15 '17 at 19:49
  • Yea I saw that post but I chose to have 2 separate multi projects. Instead, I used compile files and locate my locally generated jars. – Benoît Dubreuil Dec 15 '17 at 21:01

1 Answers1

0

In the current version of Gradle (v4.4), there's no possible way to do what I'm hoping to achieve. Instead, I chose to have two separate multi projects and to use compile files to locally pick the needed jars.

Another simpler option is to execute the "install" task from the maven plugin. Then, add mavenLocal() repository. The task publishes the jars to the local maven repository, which is accessible like a distant repository.

Benoît Dubreuil
  • 650
  • 1
  • 11
  • 27