Gradle equivalent of maven-dependency-plugin

前端 未结 1 1123
臣服心动
臣服心动 2020-12-31 14:13

My root problem is that when running \"spring-test\"-based tests for my controllers and Freemarker views I need to have all taglibs inside WEB-INF/lib folder - otherwise fre

相关标签:
1条回答
  • 2020-12-31 14:40

    Here is how I solved this problem (the same as in maven actually):

    Add another configuration for dependencies:

    configurations { 
        taglibs { transitive = false }
    }
    

    Add needed dependency to this configuration:

    dependencies {
        ...
        taglibs "org.springframework.security:spring-security-taglibs:$springSecurityVersion"
        ...
    }
    

    Add gradle code to copy these dependencies to required folder:

    task copytaglibs(type: Copy) { 
        from configurations.taglibs
        into 'src/main/webapp/WEB-INF/lib'
    } 
    
    compileTestJava {
       dependsOn copytaglibs
    }
    

    This is it.

    0 讨论(0)
提交回复
热议问题