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.
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.
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.
pedr0: you should utilize the resources plugin in that case to manually include/exclude non java files copy.
Apache Maven Resources Plugin – Including and excluding files and directories.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With