lg.lindstrom
lg.lindstrom

Reputation: 856

How to copy resources in a gradle javafx project

I have a Javafx project with Gradle. Gradle uses the standard "java" and "application" plugins.

I would like to have a project structure like this.

src
...main
.......java
...........myApp
................module1
.......................module1.fxml
.......................modele1Controller.java
.......................module1YY.java

My problem is that module1.fxml is never copied to the output directory.

I tried to make a Gradle task like:

task('fxCopy',type:Copy) {
    from(file('srcDir'))
    into(buildDir)
    include('**/*.fxml')
}
processResources.finalizedBy fxCopy

I hoped that it would copy module1.fxml to the correct location,, but no...

Gradle is new to me,, can anyone help me with a Gradle task to do the work????

/regards /lg

Upvotes: 0

Views: 1166

Answers (1)

Sundeep Gupta
Sundeep Gupta

Reputation: 1966

Add below line (and you do not need the fxCopy task)

sourceSets.main.resources.srcDir 'src/main/java'

Upvotes: 1

Related Questions