压缩一些模块,包括来自多模块 maven 项目的目标目录

问题描述

我有一个具有以下层次结构的多模块 maven 项目,我想在 mvn build 和 curl 之后创建一个 zip 或将其上传一个私有存储库。我正在使用 maven-assembly-plugin 但它不包括所需的目录。请你有什么建议吗?

|--subproject1
   |--src/main/..
   |--resoruces/..
   |target/..
   |pom.xml
|--subproject2
   |--src/main/..
   |--resoruces/..
   |pom.xml
pom.xml```

content of zip.xml

    <assembly
        xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
        <id>project</id>
        <formats>
            <format>zip</format>
        </formats>
        <includeBaseDirectory>false</includeBaseDirectory>
        <!--<fileSet></fileSet>-->
          <fileSets>
            <fileSet>
                <directory>${project.basedir}/subproject1</directory>
                <outputDirectory></outputDirectory>
                <useDefaultExcludes>true</useDefaultExcludes>
                <excludes>
                    <exclude>**/*.log</exclude>
                </excludes>
            </fileSet>
          </fileSets>
            <files>
                <file>
                    <source> ${project.basedir}/pom.xml</source>
                    <outputDirectory>/</outputDirectory>
                </file>
            </files>
    
    </assembly>
    
    below plugin is added in pom.xml of subproject1
    <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                            <configuration>
                                <appendAssemblyId>true</appendAssemblyId>
                                <descriptors>
                                    <descriptor>zip.xml</descriptor>
                                </descriptors>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

我想创建一个包含 src、资源和目标文件夹的子项目 1 的 zip。请协助。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)