Determine if a project is a Gradle Project


The framework my plugin supports recently changed from using Ant to Gradle. For a while I need to support legacy projects. So I want to detect if the project is a Gradle project or not. I found this snippet in org/jetbrains/plugins/gradle/execution/

boolean isGradleProject() {
return !GradleSettings.getInstance(project).getLinkedProjectsSettings().isEmpty();

Is that the best methodology for determining if a project is a gradle based project?

Comment actions Permalink

Yes, and/or

ExternalSystemApiUtil.isExternalSystemAwareModule(GradleConstants.SYSTEM_ID, module)
Comment actions Permalink

Hi Yann Cebron, this didn't work for me. My Gradle project returns true when I check for the module using the code you provided. I have used the following project -

Comment actions Permalink

Please create a new thread and provide the actual code you're using, ideally a link to your plugin's full sources and not snippets. Thanks.


Please sign in to leave a comment.