I had a closer look at your build.gradle and it seems that paths are a little bit off.
You specify source as src/model
, yet your project structure and Java source suggest that model
is your package name, which means the source declaration should be:
main {
java {
srcDir 'src'
}
}
Same for tests:
test {
java {
srcDir 'tests'
}
}
Now, with missing resources. In your code you are using ImageIO.read(getClass().getResource(BMPFileName))
getClass().getResource()
is using relative path to the resource. To keep the resources on the same level, you should update declaration for the resources and remove model
:
test {
java {
srcDir 'tests'
}
resources {
srcDir 'images'
}
}
You might also need to run
./gradlew clean
before it works.
Here's the result with the updated build.gradle:
Hope it helps :)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…