2

afterburner.fx for JavaFX 8 is a minimalistic (3 classes) JavaFX MVP framework based on Convention over Configuration and Dependency Injection created by Adam Bien.

afterburner.fx use Maven 3.

I would like to use it with Gradle.

How to use Afterburner.fx with Gradle instaed of Maven 3, while leaving the original project structure of afterburner.fx ?

Robert Halter
  • 362
  • 1
  • 9

2 Answers2

4

In the build.gradle File add dependencies

dependencies {
  compile group: 'com.airhacks', name:'afterburner.fx', version: afterburnerfxVersion
}

In the build.gradle File add the additional Resources (.fxml , .css , .properties)

sourceSets.main.resources.srcDirs("src/main/java").includes.addAll(["**/*.fxml", "**/*.css", "**/*.properties"])

and (re-)add all the standard Resources (in the resources folder)

sourceSets.main.resources.srcDirs("src/main/resources").includes.addAll(["**/*.*"])

Update for Gradle Version 6.8.1 : if you run gradlew with --warning-mode all there is a deprecated Message:

Copying or archiving duplicate paths with the default duplicates strategy has been deprecated. This is scheduled to be removed in Gradle 7.0.

Solution

add this line:

// from https://docs.gradle.org/6.8.1/userguide/upgrading_version_5.html#implicit_duplicate_strategy_for_copy_or_archive_tasks_has_been_deprecated
// and https://docs.gradle.org/current/userguide/java_plugin.html
// Java Plugin Task processResources(type: Copy)
processResources.duplicatesStrategy = DuplicatesStrategy.INCLUDE // allow duplicates
Robert Halter
  • 362
  • 1
  • 9
1

Thanks, this helped me a lot. I added the short form of it to dependencies:

compile 'com.airhacks:afterburner.fx:1.6.0'

Additionally I added a second line to include the files from the resources folder and not only from /java. I also added **/*.png to include png files because new Image("filename.png") wasn't working anymore.

sourceSets.main.resources.srcDirs("src/main/java").includes.addAll(["**/*.fxml", "**/*.css", "**/*.properties", "**/*.png"])

sourceSets.main.resources.srcDirs("src/main/resources").includes.addAll(["**/*.fxml", "**/*.css", "**/*.properties", "**/*.png"])

I don't know why the above two lines broke the default behavior - seems like I have to add every new file type to the above lines. :/ If anyone has a better solution please tell me.

f4b
  • 868
  • 1
  • 8
  • 10