0

I am still fairly new to Maven and am unsure of the correct roles of the various components.

I have been using the following Maven-project structure for developing microservices:

service-parent
+-- rest-service-module
+-- frontend-js-module
+-- ...

The service definition is done using Swagger and the yaml file is stored in the parent project.

I would now like to setup a site which should include documentation and reports. It seems logical to me to store the site in the parent and gather javadocs, surefire reports etc from the child modules. For example, I added swagger2markup-maven-plugin to the parent pom to generate documentation from the swagger yaml.

The first problem I have had is that the parent pom executes the swagger2markup-maven-plugin and generates HTML. However, it executes the same goal on the child modules and fails.

It seems that I am not understanding the roles of parent and child poms which leads to this problem. The Swagger documentation only needs to be generated once - not from each child module - so the parent seems the obvious choice.

So why is the plugin in the parent being executed for each child and how can I prevent that? I'm still in the early phase of the project so I can reorganise the module structure, if appropriate.

I have tried the solution suggested in https://stackoverflow.com/a/14653088/11249 but couldn't get it to work for me.

paul
  • 13,312
  • 23
  • 81
  • 144
  • I haven't configured swagger, however I wonder if the project would benefit from [splitting the parent and aggregator POMs](https://stackoverflow.com/a/21590120/944849)? – user944849 Nov 20 '18 at 18:42

1 Answers1

0

You can use -N switch to not to recurse into the subprojects when generating documentation. Execute the following command (or any other you like) on your service-parent pom.xml. (It will only be executed for this pom)

mvn -N  swagger2markup:convertSwagger2markup
miskender
  • 7,460
  • 1
  • 19
  • 23