Last active
March 30, 2018 09:19
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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