How to minimize maven pom.xml


I am working on a spring-boot maven project (Maven 3.5, Java 8). Because of using Swagger Codegen in my project to generate classes, "plugins" tag of the pom.xml is getting bigger:

<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> <version>2.2.3</version> <executions> <execution> <id>file1</id> <goals> <goal>generate</goal> </goals> <configuration> <inputSpec>src/main/resources/swagger/../file1.json</inputSpec> <generateApis>false</generateApis> <generateSupportingFiles>false</generateSupportingFiles> <generateApiDocumentation>false</generateApiDocumentation> <modelPackage>com.bla.bla.model</modelPackage> <templateDirectory>src/main/resources/swagger/templates</templateDirectory> <language>spring</language> <modelNamePrefix>ABC</modelNamePrefix> <configOptions> <interfaceOnly>true</interfaceOnly> <java8>true</java8> </configOptions> </configuration> </execution> <execution> <id>file2</id> <goals> <goal>generate</goal> </goals> <configuration> <inputSpec>src/main/resources/swagger/.../file2.json</inputSpec> <generateApis>false</generateApis> <generateSupportingFiles>false</generateSupportingFiles> <generateApiDocumentation>false</generateApiDocumentation> <modelPackage>com.bla.bla.model</modelPackage> <templateDirectory>src/main/resources/swagger/templates</templateDirectory> <language>spring</language> <modelNamePrefix>ABC</modelNamePrefix> <configOptions> <interfaceOnly>true</interfaceOnly> <java8>true</java8> </configOptions> </configuration> </execution> ...

If I move some plugins in another xml file, is it possible to include this xml file into pom.xml? If it isn't possible, then how can I minimize this file?

EDIT: This question is not a duplicate of <a href="https://stackoverflow.com/questions/2271082/is-it-possible-to-split-maven-pom-files" rel="nofollow">Is it possible to split maven pom files?</a>. My project hasn't been big yet. Only pom.xml file is getting bigger, so there is no necessity to seperate my codes into modules and organize it in a way of having parent-child pom.xml files. I need something different.


You can define common plugin properties in <pluginManagement> element once and then for each execution define only specific configurations. i.e. <inputSpec>src/main/resources/swagger/../file1.json</inputSpec>

Or you can do the same (<pluginManagment>) in another parent project and in all children put only specific configurations.



... <build> <pluginManagement> <plugins> <plugin> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> <version>2.2.3</version> <configuration> <generateApis>false</generateApis> <generateSupportingFiles>false</generateSupportingFiles> <generateApiDocumentation>false</generateApiDocumentation> <modelPackage>com.bla.bla.model</modelPackage> <templateDirectory>src/main/resources/swagger/templates </templateDirectory> <language>spring</language> <modelNamePrefix>ABC</modelNamePrefix> <configOptions> <interfaceOnly>true</interfaceOnly> <java8>true</java8> </configOptions> </configuration> </plugin> </plugins> </pluginManagement> <plugins> <plugin> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> <executions> <execution> <id>file1</id> <goals> <goal>generate</goal> </goals> <configuration> <inputSpec>src/main/resources/swagger/../file1.json</inputSpec> </configuration> </execution> <execution> <id>file2</id> <goals> <goal>generate</goal> </goals> <configuration> <inputSpec>src/main/resources/swagger/.../file2.json</inputSpec> </configuration> </execution> </executions> </plugin> </plugins> </build>



  • unable to run Htmlunit application using Maven dependency
  • Change default API spec URL in Swagger UI
  • JHipster-Registry Swagger UI for microservice says invalid_token with UAA
  • How to include Http request method name in client method names generated with NSwag
  • Nunit testing with Mock. Instance of Interface
  • Angular AOT failing at compilation (something with angular/compiler-cli)
  • Swagger for Azure Service Fabric Stateless Web API application
  • How to create external table in Hive using sqoop. Need suggestions
  • GODI-Batteries: Installation problems
  • Override Swagger sorting
  • How to specify columns in Swagger
  • Maven archetype generate with custom properties
  • PrimeFaces p:fileUpload Listener method is never invoked for mode=“simple”
  • Insert null in a database
  • how to exclude java sources from a third party jar?
  • Spring @Transactional - javax.persistence.TransactionRequiredException
  • Regarding client side code generation from WSDL
  • maven-dependency-plugin ignores outputDirectory configuration
  • Maven-Release-Plugin: Force to use specific version of scm provider
  • How can I create one checksum of two files in Maven to use it in the name of a directory
  • How to package a jar and all dependencies within a new jar with maven
  • NHibernate proxyexception
  • What is the likely cause of a net::ERR_CONNECTION_ABORTED when uploading a file to Spring
  • Implement JwtBearer Authentication in NSwag SwaggerUi
  • Redshift Querying: error xx000 disk full redshift
  • Bash if statement with multiple conditions
  • How to remove a SwiftyJSON element?
  • Installing iPhone App to iPhone
  • Swift: Switch statement fallthrough behavior
  • Could not find rake using whenever rails
  • Cannot resolve symbol 'MyApi'
  • ImageMagick, replace semi-transparent white with opaque white
  • Cannot connect to cassandra from Spark
  • How to recover from a Spring Social ExpiredAuthorizationException
  • Cross-Platform Protobuf Serialization
  • Deserializing XML into class C#
  • Alternatives to the OPTIONAL fallback SPARQL pattern?
  • How to include full .NET prerequisite for Wix Burn installer
  • costura.fody for a dll that references another dll
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize