build.gradle 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. apply plugin: 'application'
  2. java.sourceCompatibility = 8
  3. java.targetCompatibility = 8
  4. if (JavaVersion.current().isJava9Compatible()) {
  5. compileJava.options.release.set(8)
  6. }
  7. mainClassName = 'xyz.prismix.server.ServerLauncher'
  8. application.setMainClass(mainClassName)
  9. eclipse.project.name = appName + '-server'
  10. dependencies {
  11. implementation project(':shared')
  12. }
  13. jar {
  14. archiveBaseName.set(appName)
  15. // the duplicatesStrategy matters starting in Gradle 7.0; this setting works.
  16. duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
  17. dependsOn configurations.runtimeClasspath
  18. from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
  19. // these "exclude" lines remove some unnecessary duplicate files in the output JAR.
  20. exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA')
  21. dependencies {
  22. exclude('META-INF/INDEX.LIST', 'META-INF/maven/**')
  23. }
  24. // setting the manifest makes the JAR runnable.
  25. manifest {
  26. attributes 'Main-Class': project.mainClassName
  27. }
  28. // this last step may help on some OSes that need extra instruction to make runnable JARs.
  29. doLast {
  30. file(archiveFile).setExecutable(true, false)
  31. }
  32. }
  33. // Equivalent to the jar task; here for compatibility with gdx-setup.
  34. task dist(dependsOn: [jar]) {
  35. }