THUFIR
(Thufir)
August 18, 2017, 6:27pm
1
Where would I place foo.properties
so that gradle will pick up on the file?
thufir@doge:~/NetBeansProjects/props_gradle$
thufir@doge:~/NetBeansProjects/props_gradle$ gradle init --type java-library
:wrapper
:init
BUILD SUCCESSFUL
Total time: 4.869 secs
thufir@doge:~/NetBeansProjects/props_gradle$
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
thufir@doge:~/NetBeansProjects/props_gradle$
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:
java, maven, gradle, jar
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 .
THUFIR
(Thufir)
August 19, 2017, 1:40pm
3
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
2 Likes
THUFIR
(Thufir)
August 20, 2017, 4:18am
5
heh, dude I’m just trying to make gradle do what I want. bit beyond me
thanks for the reply tho.