Gradle - Exclude file from packaging with jar

I want to exclude AMAuthN.properties from the built-in jar. This file continues to be displayed in the root folder of the compiled jar. The file is located in AMAuthN\src\main\resources\AMAuthN.properties relative to the root of the project folder. Thanks!

 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' } 
+8
java gradle properties-file
source share
1 answer

You can try something like this, which I know works on my end. In build.gradle in the JAR definition add exclude . Example:

 jar { exclude('your thing') } 
+11
source share

All Articles