Hello, First of all the normal rule of thumb for Maven is, don’t fight it. If it uses by default one folder for main and test code then this is a good best practice which you should not divert from. Especially not for „multiple packages“, it is quite normal to have them all under a single source.
If there is a good reason to isolate those packages more it might be a strong hint to use multiple maven modules or projects. If you chose to ignore that advice I would go with the build helper approach described on your stackoverflow link. BTW: in case you want to build a multi-(jigsaw)module project I think there is not a clear definition for project layout yet, however having one module directory under main/java with one maven module per jigsaw module is the most classical structure. Gruss Bernd -- http://bernd.eckenfels.net ________________________________ Von: angelo moreschini <[email protected]> Gesendet: Mittwoch, August 1, 2018 8:47 AM An: [email protected] Betreff: maven - using multiple src directories Hi, I am new to maven. Actually I am able to compile and run a simple java project (if all the classes are in the same source directory). As well this, to progress in my learning (because the java language have the package structure to group classes inside directories) I need to be able to write java classes also inside multiple source directories. *Maven give me error if I write java classes in different directories.....* *How to do because this works ??* Looking on Internet I found this article : https://stackoverflow.com/questions/270445/maven-compile-with-multiple-src- directories there is the suggestion of modify the pom file in this way: ----------- <build> <finalName>osmwse</finalName> <sourceDirectory>src/main/java, src/interfaces, src/services</sourceDirectory></build> ------- Because I did it , maven now works (I can get the file.jar). .. But I am not able to run the file .jar , after I got it.. *(using the command : <java -jar osmwse.jar>)* I get the error : *Error: Could not find or load main class com.mycompany.app.App* nothing changed in the manifest.mf file... (only the pom file changed.). *I think maven have to be able to mange (in a simple way) projects with source code wrote on multiple directories...* how to do it ??? Thank you Regards
