从war文件过滤库文件

时间:2018-04-15 17:51:49

标签: java maven maven-antrun-plugin

我正在使用maven antrun插件,我正在尝试从我的war文件中排除库文件。但我无法做到。我知道它可以使用maven war插件完成,但希望它被排除在maven antrun之外。

group 'ch.wisv'
version '0.1'

apply plugin: 'java'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

jar {
    baseName = 'toornament-client'
    version = '0.1'
}

dependencies {
    // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.8.7'
    // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.8.7'
    // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.7'
    compile 'junit:junit:4.12'
    compile 'com.squareup.okhttp3:okhttp:3.6.0'

    testCompile group: 'junit', name: 'junit', version: '4.11'
    testCompile 'com.squareup.okhttp3:mockwebserver:3.6.0'
    testCompile 'org.mockito:mockito-core:2.18.0'
}

1 个答案:

答案 0 :(得分:2)

使用fileset指示库的排除jar

<fileset dir="/lib">
    <exclude name="*.jar" />
</fileset>

https://ant.apache.org/manual/Types/fileset.html

相关问题