Cristian Cristian - 5 months ago 31
Java Question

Copy file to jar root when building spring-boot project with Maven

I have a Spring Boot project and I'm building the jar file with mvn clean build.
I need to copy a folder and a file to the root of the jar, where META-INF is located. I tried maven-resources-plugin but I can't reach my goal.

For war files I used maven-war-plugin in the past but I can't find something similar for jars.

Can anybody give me an idea?

Thanks.

Answer Source

I resolved my problem by using the maven-assembly-plugin. I created an assembly zip which contains the application jar and some other resources. This solution is specific for applications which use AWS Elastic Beanstalk and need to implement the Procfile (http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-se-platform.html#java-se-procfile).