How to include custom files in JAR with Maven assembly plugin jar-with-dependencies

maven, maven-assembly-plugin, pom.xml

Solution

Put non-Java files that need to be in the final artifact in `src/main/resources`, in this case:

src/main/resources/com/app/log4j.properties

Problem

I need to include custom file (/com/app/log4.properties) in a final JAR. How can I add one file to my JAR when using jar-with-dependencies? Now there are only class files in that JAR. I'm using: ``` mvn assembly:assembly ``` My pom.xml: ``` <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.0</version> <configuration> <encoding>UTF-8</encoding> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <archive> <manifest> <mainClass>com.app.Start</mainClass> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> <executions> <execution> <id>make-assembly</id> <!-- this is used for inheritance merges --> <phase>package</phase> <!-- bind to the packaging phase --> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> </plugins> </build> ``` Thank you.

Original source