George P.
George P.

Reputation: 191

What does Gradle do with the files, which are located in src/main/resources directory?

I'm trying to figure out, what Gradle does with the files, which are located in src/main/resources directory.

Upvotes: 0

Views: 397

Answers (2)

Martin Zeitler
Martin Zeitler

Reputation: 76639

it might do nothing with them, but ignore them - per default (with the Android plugin) that directory is called res, only the Java plugin would take the resources directory into account (the question does not indicate which plugin is used). otherwise it would run a processResources task on them; only res/raw is not being processed (copied 1:1).

Upvotes: 1

JB Nizet
JB Nizet

Reputation: 691695

The processResources task, added by the java plugin to the project, copies them to the build/resources/main directory.

The content of this directory is bundled into the jar file created by the jar task that is also added by the java plugin, and the resources can thus be loaded, at runtime, by the ClassLoader.

See the documentation of the java plugin.

Upvotes: 2

Related Questions