Why i can not access java.io.FileInputStream and j...
# gradle
i
Why i can not access java.io.FileInputStream and java.util.Properties in
buildSrc
build.gradle.kts? Import directive and usage looks good (compiler do not warn) but when i try to build project i get many errors looks like build.gradle.kts of buildSrc failed to build
e
possibly
java
is resolving to the Gradle extension name and not the package name
if the error is coming from a fully-qualified reference, try using an import statement instead
i
I use import statements, not the fully-qualified reference
e
should work fine within .kt files in buildSrc. .kts files, 🤷
i
I would to unify somehow buildSrc build.gradle.kts deps and root build.gradle.kts deps. Good way is store shared deps in .properties, but i must somehow get these version from properties inside .kts file 🤷
Already solved this with symbolic link:
Copy code
ln gradle.properties buildSrc/gradle.properties
and then
Copy code
project.properties["NAME"]
but what if i want to read another properties file? Local properties for example? This way will not work. How can i read properties from any file in build script in buildSrc?
v
FileInputStream
and
Properties
work fine if you use them properly. I guess you just don't use the right paths. If you would have provided what actual error you have, this would have been much more obvious.
If you for example use relative paths, in Java (and thus Kotlin), they are always relative to the current working directory, so bad for things that are not user-specified on the command line
i
Hm. Tried to reproduce, but when i’ve made exactly the same as when tried early - all builds fine ¯\_(ツ)_/¯ looks like my fault. But I’ll report if i met that error again.
👌 1