I am working on a maven project which generate war file. I want to generate a jar and include it to another project as a dependency. I have generated the jar file correctly(${project.artifactId}-${project.version}.jar), but when I check the jar file in .m2 folder it has same structure as war file. Hence, my second project can’t resolve the classes of first project.
I am new to maven, any help on this would be highly appreciated.
Thanks
finalName section in maven is only for overriding default settings. There you can only set a output name – not the structure. The structure of output always will be the war.
I has similar problem. The solution is to create second project which contains only java classes and packing set to jar
<packaging>jar</packaging>. In your main project with war add the previous one as dependency.I prefer multi-module projects. Create parent pom and add both projects as modules.