Provided dependencies using Gradle (JetGradle) and Intellij Idea 13

前端 未结 3 1949
死守一世寂寞
死守一世寂寞 2021-02-14 02:12

I have a multiproject build with multiple war modules that depends on one jar module.

Both war and jar modules have dependencies over libraries like Spring, Hibernate an

3条回答
  •  时光说笑
    2021-02-14 02:37

    The best solution I found was to set the transitive "compile" dependencies from the jar module as provided using the following code in the Gradle configuration file:

    apply plugin: 'idea'
    
    configurations {
        provided
        provided.extendsFrom(compile)
    }
    
    idea {
        module {
            scopes.PROVIDED.plus += configurations.provided
        }
    }
    

    For Gradle 2.0+ modify the last bit to be like this:

    idea {
        module {
            scopes.PROVIDED.plus += [configurations.provided]
        }
    }
    

    This solution works using the Intellij Gradle plugin and also the idea task in Gradle

    I got this solution working based on the info on this urls: https://github.com/Netflix/RxJava/pull/145 http://www.gradle.org/docs/current/dsl/org.gradle.plugins.ide.idea.model.IdeaModule.html

    I hope this helps someone else

提交回复
热议问题