Part 3- Adding plugins to multi-module MVN project to perform specific tasks

This extends Part 1: Creating an empty multi module maven project structure and Part 2- Adding dependency jars to multi-module MVN project. The “pluginManagement” defines the settings for plugins that will be inherited by modules in your build. Let’s define the jaxb2 plugin in the parent pom file “simple-app-parent/pom.xml” file to generate Java classes from a XSD file.

maven multi-module project

maven multi-module project

Now in the child pom “simple-app-service/pom.xml“, let’ts add plugin configuration to generate Java classes from XSDs.

Add a source folder called “src/main/resources/schema“, and then the Comapny.xsd file inside it.

Finally, if you run “mvn clean install”, you will see new Java classes created from the Company.xsd file with the help of Maven plugin “maven-jaxb2-plugin“. There are so many plugins to choose from to perform specific tasks in Maven.

mvn-multi-module-plugin-jaxb2


Java Developer Interview Q&As

800+ Java Interview Q&As

Top