Skip to content

Instantly share code, notes, and snippets.

@youribonnaffe youribonnaffe/gist:7401737
Last active Mar 30, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.