Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In maven how can I include non-java src files in the same place in the output jar?

Tags:

maven

jar

I received a source code bundle. Inside the src directory tree there are some properties files(.properties) which I want to keep in the output jar in the same place. e.g: I want

src/main/java/com.mycompany/utils/Myclass.java  src/main/java/com.mycompany/utils/Myclass.properties 

to stay the same in the jar:

com.mycompany/utils/Myclass.class  com.mycompany/utils/Myclass.properties 

without needing to add the properties file it to separate resources folder. Is there a way to I tell this to maven?

like image 758
Paralife Avatar asked Dec 22 '10 12:12

Paralife


1 Answers

You could add the following in your pom indicating that the resources are available in src/main/java and including the type of resources.

<build>     <resources>         <resource>             <directory>src/main/java</directory>             <includes>                 <include>**/*.properties</include>             </includes>         </resource>     </resources> </build> 
like image 173
Raghuram Avatar answered Oct 11 '22 20:10

Raghuram