Gradle - Exclude file from being packaged with jar

Wes

I want to exclude AMAuthN.properties from the built jar. This file keeps showing up in the root folder of the compiled jar. The file is located at AMAuthN\src\main\resources\AMAuthN.properties relative to the project folder root. 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'
}
SomeStudent

You can try something like this, which i know works on my end. In your build.gradle under the JAR definition add your exclude. Ex:

jar {     
   exclude('your thing')     
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Gradle: How to exclude a particular package from a jar?

From Dev

Exclude .jar from compile in Android Studio with Gradle

From Dev

Copy file from a jar in a custom gradle plugin

From Dev

Intellij exclude file from being compiled

From Dev

Exclude property from being indexed

From Dev

Opening a PDF file that is packaged in a JAR

From Dev

Gradle: How to exclude javax.realtime package from JScience jar dependency (Multiple dex define)

From Dev

How to exclude file from resources using Gradle and Android Studio?

From Dev

Gradle: Exclude file from Android assets folder

From Dev

Exclude package from external JAR in Android Studio during Gradle build process

From Dev

Exclude BuildConfig.class and R.class from Android library jar in Gradle

From Dev

How to exclude a file from an .AAR Android library archive with gradle

From Dev

Exclude META-INF/maven folder from the generated jar file

From Dev

How to exclude resource file from spring boot jar?

From Dev

How to exclude modules or groups in a jar from Gradle?

From Dev

In an Android Gradle build, how to exclude dependencies from an included jar file?

From Dev

Exclude file from jar as built by jar-with-dependencies

From Dev

Gradle build: Exclude resources files from Spring Boot Jar file

From Dev

Gradle - Exclude file from being packaged with jar

From Dev

NoClassDefFoundError as I run a Maven packaged JAR file

From Dev

Exclude certain values being displayed from a csv file

From Dev

Opening a PDF file that is packaged in a JAR

From Dev

How to Read PNG from a jar packaged in a war

From Dev

Executing wmv file packaged in jar

From Dev

exclude target redirection file from being processed in for loop

From Dev

How do I exclude a certain groovy file from being compiled in gradle?

From Dev

Gradle - Ignore specfic jars from Jar file

From Dev

Omit class file from jar in gradle

From Dev

Accessing classes from libraries packaged in a jar

Related Related

  1. 1

    Gradle: How to exclude a particular package from a jar?

  2. 2

    Exclude .jar from compile in Android Studio with Gradle

  3. 3

    Copy file from a jar in a custom gradle plugin

  4. 4

    Intellij exclude file from being compiled

  5. 5

    Exclude property from being indexed

  6. 6

    Opening a PDF file that is packaged in a JAR

  7. 7

    Gradle: How to exclude javax.realtime package from JScience jar dependency (Multiple dex define)

  8. 8

    How to exclude file from resources using Gradle and Android Studio?

  9. 9

    Gradle: Exclude file from Android assets folder

  10. 10

    Exclude package from external JAR in Android Studio during Gradle build process

  11. 11

    Exclude BuildConfig.class and R.class from Android library jar in Gradle

  12. 12

    How to exclude a file from an .AAR Android library archive with gradle

  13. 13

    Exclude META-INF/maven folder from the generated jar file

  14. 14

    How to exclude resource file from spring boot jar?

  15. 15

    How to exclude modules or groups in a jar from Gradle?

  16. 16

    In an Android Gradle build, how to exclude dependencies from an included jar file?

  17. 17

    Exclude file from jar as built by jar-with-dependencies

  18. 18

    Gradle build: Exclude resources files from Spring Boot Jar file

  19. 19

    Gradle - Exclude file from being packaged with jar

  20. 20

    NoClassDefFoundError as I run a Maven packaged JAR file

  21. 21

    Exclude certain values being displayed from a csv file

  22. 22

    Opening a PDF file that is packaged in a JAR

  23. 23

    How to Read PNG from a jar packaged in a war

  24. 24

    Executing wmv file packaged in jar

  25. 25

    exclude target redirection file from being processed in for loop

  26. 26

    How do I exclude a certain groovy file from being compiled in gradle?

  27. 27

    Gradle - Ignore specfic jars from Jar file

  28. 28

    Omit class file from jar in gradle

  29. 29

    Accessing classes from libraries packaged in a jar

HotTag

Archive