Where does a properties file go?

Where would I place foo.properties so that gradle will pick up on the file?

thufir@doge:~/NetBeansProjects/props_gradle$ gradle init --type java-library


Total time: 4.869 secs
thufir@doge:~/NetBeansProjects/props_gradle$ tree
├── build.gradle
├── gradle
│   └── wrapper
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
└── src
    ├── main
    │   └── java
    │       └── Library.java
    └── test
        └── java
            └── LibraryTest.java

7 directories, 8 files

I’d want the properties file to be picked so that it can be parsed, of course. Preferably in META-INF but not necessarily so:

Not sure what you’re asking.

Do you want foo.properties to be bundled in your jar ? Then place it it under src/main/resources or src/main/resources/META-INF. Anything from there will firstly be copied by the processResources task then later bundled by the jar task.

Do you want Gradle to make use of values in foo.properties ? In that case you need the Java PropFile plugin.

Thanks for confirming, appreciated.

Tangential: why doesn’t gradle init --type java-library create the, or some, resources directories?

I guess it is because whoever wrote the specific recipe for the Build Init plugin did not think of that. It would make for a good little PR. Code is here -> https://github.com/gradle/gradle/tree/master/subprojects/build-init/src/main/java/org/gradle/buildinit/plugins/internal


heh, dude I’m just trying to make gradle do what I want. bit beyond me :slight_smile:

thanks for the reply tho.