Maven assembly or shade plugin - How to exclude sources from jar?

Alex Botev

I want to know if it is possible to exclude some resources from my maven project to be bundled within the jar file, either using the assembly or shade plugin. Note that I can do this by putting in the build DOM node:

<resources>
        <resource>
            <directory>src/main/resources</directory>
            <excludes>
                <exclude>**</exclude>
            </excludes>
            <filtering>false</filtering>
        </resource>
</resources>

but I'm looking for something else, as this screws up my eclipse setup.

PS:For instance I want to exclude the whole src/main/resources/config folder from the jar and instead copy it in the target folder. To copy I use maven-resource-plugin, but can't exclude it.

Michael Koch

You could put the excluded resources in src/main/config instead of src/main/resources/config and configure the maven-resources-plugin accordingly. Per convention, the resources directory is for resources which go into the Jar file. It is OK to create your own directories under src/main for unconventional usages.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to use maven assembly plugin to exclude a package from dependency jar?

From Dev

Maven: exclude dependency from shade plugin

From Dev

use maven shade plugin like assembly plugin

From Dev

How to add resources to jar using maven shade plugin

From Dev

How to add resources to jar using maven shade plugin

From Dev

How do I exclude java files from a jar in maven-jar-plugin?

From Dev

How to exclude transitive dependencies with scope provided with maven-assembly-plugin?

From Dev

Exclude packages while generating sources jar in Maven

From Dev

How to exclude a package from a jar (with maven)

From Dev

Maven - How to exclude dependencies from generated JAR

From Dev

maven-shade-plugin : exclude a dependency and all its transitive dependencies

From Dev

How to add files from webapp directory to jar using Maven Assembly plugin?

From Dev

How to include tools.jar into uberjar (using maven-shade-plugin)?

From Dev

How does the Maven shade plugin decide which dependencies to put into the final jar when using the minimizeJar function?

From Dev

How to use maven shade to build jar and war

From Dev

How to include package.jar with maven-assembly-plugin

From Dev

How to configure a manifest file of a jar file by using the maven assembly plugin?

From Dev

Exclude file directory, by assembly plugin MAVEN

From Dev

Maven-shade-plugin, uber-jar and overlapping classes

From Dev

Maven shade plugin isn't placing dependency class files into jar

From Dev

I wish to exclude some class files from my jar. I am using maven-assembly-plugin. It still adds the files. I dont get any error

From Dev

maven: exclude jar from JDK

From Dev

maven-dependency-plugin: exclude .jar files

From Dev

maven-assembly-plugin and jar name conflict

From Dev

Execution order of maven-assembly-plugin and maven-jar-plugin

From Dev

How to exclude certain resources from the maven war plugin war file?

From Dev

How to exclude jasperreports artifact from jasperreports maven plugin

From Dev

How to exclude project dependency from classpath used by maven plugin

From Dev

How Exclude Plugin from integration-test in Eclipse RCP / Maven

Related Related

  1. 1

    How to use maven assembly plugin to exclude a package from dependency jar?

  2. 2

    Maven: exclude dependency from shade plugin

  3. 3

    use maven shade plugin like assembly plugin

  4. 4

    How to add resources to jar using maven shade plugin

  5. 5

    How to add resources to jar using maven shade plugin

  6. 6

    How do I exclude java files from a jar in maven-jar-plugin?

  7. 7

    How to exclude transitive dependencies with scope provided with maven-assembly-plugin?

  8. 8

    Exclude packages while generating sources jar in Maven

  9. 9

    How to exclude a package from a jar (with maven)

  10. 10

    Maven - How to exclude dependencies from generated JAR

  11. 11

    maven-shade-plugin : exclude a dependency and all its transitive dependencies

  12. 12

    How to add files from webapp directory to jar using Maven Assembly plugin?

  13. 13

    How to include tools.jar into uberjar (using maven-shade-plugin)?

  14. 14

    How does the Maven shade plugin decide which dependencies to put into the final jar when using the minimizeJar function?

  15. 15

    How to use maven shade to build jar and war

  16. 16

    How to include package.jar with maven-assembly-plugin

  17. 17

    How to configure a manifest file of a jar file by using the maven assembly plugin?

  18. 18

    Exclude file directory, by assembly plugin MAVEN

  19. 19

    Maven-shade-plugin, uber-jar and overlapping classes

  20. 20

    Maven shade plugin isn't placing dependency class files into jar

  21. 21

    I wish to exclude some class files from my jar. I am using maven-assembly-plugin. It still adds the files. I dont get any error

  22. 22

    maven: exclude jar from JDK

  23. 23

    maven-dependency-plugin: exclude .jar files

  24. 24

    maven-assembly-plugin and jar name conflict

  25. 25

    Execution order of maven-assembly-plugin and maven-jar-plugin

  26. 26

    How to exclude certain resources from the maven war plugin war file?

  27. 27

    How to exclude jasperreports artifact from jasperreports maven plugin

  28. 28

    How to exclude project dependency from classpath used by maven plugin

  29. 29

    How Exclude Plugin from integration-test in Eclipse RCP / Maven

HotTag

Archive