Skip to content

Commit

Permalink
configured gradle and java to be able to create a working fat jar
Browse files Browse the repository at this point in the history
  • Loading branch information
Ksawery Chodyniecki committed Sep 16, 2021
1 parent dd2f2c5 commit 66d2354
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 16 deletions.
39 changes: 23 additions & 16 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,38 +1,45 @@
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java application project to get you started.
* For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
* User Manual available at https://docs.gradle.org/7.2/userguide/building_java_projects.html
*/

plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.10'
}

repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
// --module-path ../../Libraries/Java/javafx-sdk-11.0.2/lib
}

dependencies {
// Use JUnit test framework.
testImplementation 'junit:junit:4.13.2'

// This dependency is used by the application.
implementation 'com.google.guava:guava:30.1.1-jre'
implementation 'org.postgresql:postgresql:42.2.19'

testImplementation 'junit:junit:4.13.2'

runtimeOnly "org.openjfx:javafx-graphics:$javafx.version:win"
runtimeOnly "org.openjfx:javafx-graphics:$javafx.version:linux"
runtimeOnly "org.openjfx:javafx-graphics:$javafx.version:mac"
}

application {
// Define the main class for the application.
mainClass = 'BerryGoodRecipes.App'
}

javafx {
version = "11.0.2"
modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.media' ]
}

jar {
manifest {
attributes(
'Main-Class': 'BerryGoodRecipes.Main',
"Implementation-Title": "Gradle",
"Implementation-Version": archiveVersion
)
}

duplicatesStrategy = 'include'

from {
exclude '**/module-info.class'
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
}
}
12 changes: 12 additions & 0 deletions app/src/main/java/BerryGoodRecipes/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// this file exists to fix the fat jar issue in JavaFX 11

package BerryGoodRecipes;

import java.io.IOException;
import java.sql.SQLException;

public class Main {
public static void main(String[] args) throws SQLException, IOException {
App.main(args);
}
}

0 comments on commit 66d2354

Please sign in to comment.