Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle missing build.gradle file #86

Closed
bjorndarri opened this issue Feb 20, 2019 · 9 comments · Fixed by #89
Closed

Handle missing build.gradle file #86

bjorndarri opened this issue Feb 20, 2019 · 9 comments · Fixed by #89

Comments

@bjorndarri
Copy link

I have a submodule without a build.gradle file, since it has no configuration or dependencies other than what is specified in the root module build file.

This results in the following error:

org.gradle.api.tasks.TaskValidationException: A problem was found with the configuration of task ':[module]:generateDependencyGraph'.
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.report(ValidatingTaskExecuter.java:67)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:54)
..
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.api.InvalidUserDataException: File '/[filesystem path]/build.gradle' specified for property 'inputFile' does not exist.
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.report(ValidatingTaskExecuter.java:64)

I solved this by creating an empty build.gradle file, but keeping an empty build.gradle file smells a bit iffy.

@vanniktech
Copy link
Owner

Having a Gradle module without a build.gradle file smells a bit iffy to me.

@bjorndarri
Copy link
Author

Yeah, I don't really know what to say to that, except that Gradle supports submodules without a build file and no build file smells better to me than an empty build file.

Since this is becoming a war of the noses and quite subjective feel free to close this. I'll just add an empty build file when I generate dependency graphs, hell, I might event keep it under source control, since I like this plugin so much :).

@vanniktech
Copy link
Owner

What does the Gradle API say though? Is it really allowed to be null? If it is then we should honor that.

@bjorndarri
Copy link
Author

@vanniktech
Copy link
Owner

@bjorndarri want to create a PR that handles the case where a build.gradle file is missing?

@bjorndarri
Copy link
Author

I'm afraid I have practically zero experience with Gradle plugin development and Kotlin, so I don't think I'm the one for the job. I may look into this at some point though, since I'm interested in both Gradle and Kotlin, but I wouldn't bet on me fixing this issue any day soon.

@vanniktech
Copy link
Owner

Do you have a sample repo how I can set up a Gradle module without a build.gradle file?

@bjorndarri
Copy link
Author

I've created a minimal multi module example where the api module does not have a build.gradle file. The generateDependencyGraph task fails when run for the api module.
https://github.com/bjorndarri/gradle-multi-module-example

@vanniktech
Copy link
Owner

Thanks. I'll have a look when I have some spare time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants