zip多模块maven项目中的一些模块,包括目标目录

ggazkfy8  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(248)

我有一个具有以下层次结构的多模块maven项目,希望在mvn构建和curl之后创建一个zip,或者将其上载到一个私有存储库。我正在使用maven汇编插件,但它不包括所需的目录。你能给点建议吗?

  1. |--subproject1
  2. |--src/main/..
  3. |--resoruces/..
  4. |target/..
  5. |pom.xml
  6. |--subproject2
  7. |--src/main/..
  8. |--resoruces/..
  9. |pom.xml
  10. pom.xml```
  11. content of zip.xml
  12. <assembly
  13. xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
  14. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  15. xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
  16. <id>project</id>
  17. <formats>
  18. <format>zip</format>
  19. </formats>
  20. <includeBaseDirectory>false</includeBaseDirectory>
  21. <!--<fileSet></fileSet>-->
  22. <fileSets>
  23. <fileSet>
  24. <directory>${project.basedir}/subproject1</directory>
  25. <outputDirectory></outputDirectory>
  26. <useDefaultExcludes>true</useDefaultExcludes>
  27. <excludes>
  28. <exclude>**/*.log</exclude>
  29. </excludes>
  30. </fileSet>
  31. </fileSets>
  32. <files>
  33. <file>
  34. <source> ${project.basedir}/pom.xml</source>
  35. <outputDirectory>/</outputDirectory>
  36. </file>
  37. </files>
  38. </assembly>
  39. below plugin is added in pom.xml of subproject1
  40. <plugin>
  41. <groupId>org.apache.maven.plugins</groupId>
  42. <artifactId>maven-assembly-plugin</artifactId>
  43. <executions>
  44. <execution>
  45. <phase>package</phase>
  46. <goals>
  47. <goal>single</goal>
  48. </goals>
  49. <configuration>
  50. <appendAssemblyId>true</appendAssemblyId>
  51. <descriptors>
  52. <descriptor>zip.xml</descriptor>
  53. </descriptors>
  54. </configuration>
  55. </execution>
  56. </executions>
  57. </plugin>

我想用subproject1创建一个包含src、resources和target文件夹的zip。请帮忙。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题