Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Including non-Java sources in a Maven project

Tags:

maven-2

maven

I'm starting on a project that I expect will include a substantial amount of non-Java code (mostly shell and SQL scripts).

I would still like to manage this project with Maven. What are the best practices wrt non-Java source code and Maven? Where should the source go? What happens to them during the different lifecycle phases? Any pointers or links to more information would be greatly appreciated.

like image 714
lindelof Avatar asked Oct 06 '08 13:10

lindelof


People also ask

Can maven be used for non Java projects?

Can Maven Be Used For Non-Java Projects? Yes. There are hundreds of archetypes for Maven, ranging from Java web application development to eBook publishing.

Is maven only for Java projects?

Maven is chiefly used for Java-based projects, helping to download dependencies, which refers to the libraries or JAR files. The tool helps get the right JAR files for each project as there may be different versions of separate packages.

Which plugin is used to coffee filter include and exclude non Java files into your final project?

pedr0: you should utilize the resources plugin in that case to manually include/exclude non java files copy.

Which plugin is used to copy filter include and exclude non Java files?

Apache Maven Resources Plugin – Including and excluding files and directories.


1 Answers

You must not put the non-Java code into resources, if you don't want to include these files into your JAR files like heckj has suggested. Everything that is located in resources is automatically copied into the JAR file and I guess you don't want shell scripts and SQL scripts be included in a JAR file, right?

So the Maven way would be to create additional folders under src/main. E.g. create a sql folder for your SQL scripts, an sh folder for your shell scripts and so on. This is the location where other Maven plugins also expect sources, e.g. for C++, Groovy and so on.

like image 65
Yaba Avatar answered Oct 20 '22 19:10

Yaba