Skip to content

Instantly share code, notes, and snippets.

@youribonnaffe
Last active March 30, 2018 09:19
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save youribonnaffe/7401737 to your computer and use it in GitHub Desktop.
Save youribonnaffe/7401737 to your computer and use it in GitHub Desktop.
Gradle IDEA add project dependencies instead of JAR dependencies in Intellij configuration file (.iml)
apply plugin: 'idea'
idea.module.iml {
def customDependencies = ['org.objectweb.proactive', 'org.ow2.proactive']
whenMerged { module ->
// to reorder dependencies
def existingDependencies = module.dependencies
module.dependencies = new LinkedHashSet()
configurations.compile.resolvedConfiguration.resolvedArtifacts.each {
if (it.moduleVersion.id.group == project.group || customDependencies.contains(it.moduleVersion.id.group) ) {
logger.info("Custom idea: adding ${it.name}")
module.dependencies.add(new org.gradle.plugins.ide.idea.model.ModuleDependency(it.name, 'COMPILE'))
}
}
module.dependencies.addAll(existingDependencies)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment