[solved] Managing subprojects with gradle

Hello everybody,
I am absolutly beginner with gradle, but i read already some of these links:

http://www.vogella.com/tutorials/Gradle/article.html
http://www.vogella.com/tutorials/EclipseGradle/article.html

https://docs.gradle.org/3.3/userguide/multi_project_builds.html#sec:subproject_configuration

My question is the following:
I have a java-project with the following structure:

rmi-tutorial
→ client
→ server
→ lib

the client and the server need ‘lib’ as dependency. My goal is to build at least 2 jar archives. One for client and one for server.

At the moment I have the following configuration with gradle:

my settings.gradle file in the root-project dir:

include ‘client’, ‘lib’, ‘server’
rootProject.name = ‘rmi-tutorial’

my build.gradle file in root-project dir:

subprojects {
apply plugin: ‘java’
apply plugin: ‘eclipse’

repositories {
mavenCentral()
}

dependencies {
testCompile ‘junit:junit:4.12’
}

version = ‘1.0’

jar {
manifest.attributes provider: ‘gradle’
}
}

And a build.gradle file in the subprojects server and client that looks like this:

dependencies {
compile project(‘:lib’)
}

My current goal is to compile a jar for the subprojects server and client.
When i execute gradle build at the moment I just get ‘empty’ jars for server, client and lib. They are 1kb big and just consist a Manifest.mf file with the version of the project…

My future goals are:

  • i want to include the security policy file for RMI it should get triggered when i run the jars. So the file needs to be in the jars.
  • I want to have a build mode there i just build the class files without generating the jars. (for debugging)
  • i maybe want to include other files into the jar archives… but that are all future goals. I would be happy if at least building the jars would work.

My Project Structure was wrong. Its working now