我正在開發一個spring-boot maven項目(Maven 3.5,Java 8)。因爲在我的項目中使用揚鞭代碼生成,生成類,pom.xml中的「插件」標籤越來越大:如何最小化maven pom.xml
<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>
...
如果我在另一個XML文件,還可以將一些插件,是有可能包括該XML文件到pom.xml中?如果這是不可能的,那麼我怎樣才能最小化這個文件?
編輯:這個問題不是Is it possible to split maven pom files?的重複。我的項目還沒有很大。只有pom.xml文件變得越來越大,所以沒有必要將我的代碼分離到模塊中,並以具有父 - 子pom.xml文件的方式對其進行組織。我需要不同的東西。
的可能的複製[?是否有可能分裂的Maven POM文件(https://stackoverflow.com/questions/ 2271082/is-it-it-it-split-maven-pom-files) – OldProgrammer
查看OldProgrammer對常用maven方式的評論。您可以嘗試使用polyglot maven(https://github.com/takari/polyglot-maven)來使用除XML以外的其他格式的pom文件,並在支持的方言中選擇您想要的任何方言。如果你的項目足夠小,你也可以考慮切換到gradle –