2017-04-24 2 views
0

내가 buildscript 한 블록 :일부 buildscript 클래스 경로 JAR을 복사하지만 Gradle에서 다른 클래스를 제외시키는 방법은 무엇입니까? 많은 JAR 파일을 참조

나는 (내 WAR 파일) 참조 된 JAR 파일의 일부 (예 : Gradle을-CSS-플러그인의 의존성, Gradle을-JS-플러그인, 폐쇄를 복사 할
buildscript { 
    dependencies { classpath "com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13" } 
    dependencies { classpath "com.eriwen:gradle-css-plugin:2.14.0" } 
    dependencies { classpath "com.eriwen:gradle-js-plugin:2.14.1" } 
    dependencies { classpath "com.google.javascript:closure-compiler:v20160208" } 
    dependencies { classpath "org.akhikhl.gretty:gretty:+" } 
} 

task copyWarGradlePlugins(type: Copy) { 
    destinationDir = file(project.buildDir.name + '/warGradlePlugins') 

    from (buildscript.configurations.classpath) 
} 

(예 : gretty, jmeter-gradle-plugin).

jmeter-gradle-plugin 및 모든 종속성을 어떻게 제외합니까?

업데이트 :
150 개 이상의 JAR 파일이 있습니다. 파일 이름별로 제외하는 것은 실용적이지 않고 유지 관리가 쉽지 않습니다.

답변

0
buildscript { 
    dependencies { classpath "com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13" } 
    dependencies { classpath "com.eriwen:gradle-css-plugin:2.14.0" } 
    dependencies { classpath "com.eriwen:gradle-js-plugin:2.14.1" } 
    dependencies { classpath "com.google.javascript:closure-compiler:v20160208" } 
    dependencies { classpath "org.akhikhl.gretty:gretty:+" } 
} 

task copyWarGradlePlugins(type: Copy) { copy -> 
    destinationDir = file(project.buildDir.name + '/warGradlePlugins') 

    copy.from(buildscript.configurations.classpath) { copySpec -> 
     // exclusions are based on the file name as here you will be handed 
     // DefaultFileVisitDetails type 
     copySpec.exclude { it.name.startsWith 'gretty' } 
     copySpec.exclude { it.name.startsWith 'closure-compiler' } 
    } 
} 
+0

150 개가 넘는 JAR 파일이 있습니다. 이름으로 그들을 제외시키는 것은 실용적이지 않거나 유지할 수 없다. – isobretatel

관련 문제