//publishing to maven subprojects { apply plugin: 'maven-publish' //generate sources jar task sourceJar(type: Jar) { from sourceSets.main.allSource } //put the tests in a jar task testsJar(type: Jar, dependsOn: testClasses) { from sourceSets.test.output } publishing { repositories { maven { url project.localRepositoryPath } // maven { // url 'sftp://:/' // credentials { // username = 'username' // password = 'password' // } // } } publications { mavenJava(MavenPublication) { from components.java artifact sourceJar { classifier "sources" } artifact testsJar { classifier "tests" } } } } }