2017-04-24 4 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) 
} 

-compiler)ではなく、他のもの(例えば、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

関連する問題