2016-07-29 34 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