微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决压缩一些模块,包括来自多模块 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 举报,一经查实,本站将立刻删除。