Reputation: 14379
I have a Gradle project which I can currently import into IntelliJ via the build.gradle
file. IntelliJ will setup the correct source locations and pull in the dependencies for me.
What I would like to do is list the IntelliJ "run configurations" in the build.gradle
file so it will automatically set these up for me (correct class/arguments). Is this possible?
Upvotes: 2
Views: 2630
Reputation: 3296
There is an experimental plugin for Gradle developed by an employee of JetBrains.
https://github.com/JetBrains/gradle-idea-ext-plugin
It provides several options to adjust the configuration of IntelliJ from within the build-script. Adding a run configuration could look like this.
plugins {
id "org.jetbrains.gradle.plugin.idea-ext" version "0.5"
}
idea.project.settings.runConfigurations {
'App'(org.jetbrains.gradle.ext.Application) {
mainClass = 'com.example.myapp.App'
moduleName = project.idea.module.name + '.main'
programParameters = '--some-option some-argument'
jvmArgs = '-Xmx1G'
}
}
Upvotes: 3