diff --git a/build.gradle b/build.gradle index c89aff1..d666ffc 100644 --- a/build.gradle +++ b/build.gradle @@ -1,56 +1,66 @@ -apply plugin: 'java' -apply plugin: 'maven' +plugins { + id 'java-library' + id 'maven-publish' +} version='1.0.1-SNAPSHOT' group='com.simsilica' +// Configuration to produce maven-repo style -sources and -javadoc jars +java { + withJavadocJar() + withSourcesJar() +} + repositories { mavenLocal() - jcenter() - - // Temporary until JME jars are in jcenter() - maven { url "http://dl.bintray.com/jmonkeyengine/org.jmonkeyengine" } + mavenCentral() + // jcenter() is deprecated since Gradle 6.7 and will be removed in Gradle 9.0. + // see https://docs.gradle.org/8.7/userguide/upgrading_version_6.html#jcenter_deprecation } // Make sure the build file declares what it actually imports -configurations.compile { +configurations.implementation { transitive = false } // In this section you declare the dependencies for your production and test code dependencies { - compile "org.jmonkeyengine:jme3-core:3.1.+" - //compile "com.jme3:jme3-core:unknown" - compile 'org.slf4j:slf4j-api:1.7.13' - - runtime files("assets") -} - + implementation "org.jmonkeyengine:jme3-core:3.6.1-stable" + //implementation "com.jme3:jme3-core:unknown" + implementation 'org.slf4j:slf4j-api:1.7.13' -// Configuration to produce maven-repo style -sources and -javadoc jars -task sourcesJar(type: Jar) { - classifier = 'sources' - from sourceSets.main.allSource - exclude '**/.backups' + runtimeOnly files("assets") } -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} - task assetsJar(type: Jar) { - classifier = 'assets' + archiveClassifier = 'assets' from file('assets') exclude '**/*.psd' exclude '**/.backups' } - + artifacts { - archives sourcesJar - archives javadocJar - archives assetsJar + assetsJar +} + +// Publishing does not work for me without this stanza, and I don't know why +// not, which is not satisfactory. Even with it, publishing assets does not +// work. The assets jar is built but is not copied to local maven. Copying +// the file manually to local maven does then make it available to consumers, +// but this is not good enough. +publishing { + publications { + customLibrary(MavenPublication) { + from components.java + } + //artifact assetsJar + } + + repositories { + mavenLocal() + } }