2016-07-29 83 views
8

我想要排除AMAuthN.properties从内置罐子。该文件不断显示在编译的jar的根文件夹中。该文件位于相对于项目文件夹根目录的AMAuthN\src\main\resources\AMAuthN.properties。谢谢!Gradle - 从包装中删除文件与罐子

apply plugin: 'java' 
apply plugin: 'eclipse' 

version = '1.0' 
sourceCompatibility = 1.6 
targetCompatibility = 1.6 

test { 
    testLogging { 
     showStandardStreams = true 
    } 
} 

// Create a single Jar with all dependencies 
jar { 
    manifest { 
     attributes 'Implementation-Title': 'Gradle Jar File Example', 
      'Implementation-Version': version, 
      'Main-Class': 'com.axa.openam' 
    } 

    baseName = project.name 

    from { 
     configurations.compile.collect { 
      it.isDirectory() ? it : zipTree(it) 
     } 
    } 
} 

// Get dependencies from Maven central repository 
repositories { 
    mavenCentral() 
} 

// Project dependencies 
dependencies { 
    compile 'com.google.code.gson:gson:2.5' 
    testCompile 'junit:junit:4.12' 
} 

回答

11

你可以尝试这样的事情,我知道这是我的工作。在你的build.gradle下的JAR定义中加上你的,排除。例如:

jar {  
    exclude('your thing')  
} 
+2

排除一个物多用:'罐子{排除( 'thing1', 'thing2')}' –

+0

好点,具有逻辑意义也是如此。 – SomeStudent