Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/399.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用maven assembly插件更改moduleSet/sources的输出目录_Java_Maven_Maven Assembly Plugin - Fatal编程技术网

Java 如何使用maven assembly插件更改moduleSet/sources的输出目录

Java 如何使用maven assembly插件更改moduleSet/sources的输出目录,java,maven,maven-assembly-plugin,Java,Maven,Maven Assembly Plugin,我想用更改的输出目录。我尝试了moduleSet/sources/outputDirectory,但得到了一个奇怪的zip文件 我的描述: <?xml version="1.0" encoding="UTF-8"?> <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-i

我想用更改的输出目录。我尝试了
moduleSet/sources/outputDirectory
,但得到了一个奇怪的zip文件

我的描述:

<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">

    <id>distribution</id>
    <formats>
        <format>zip</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>

    <moduleSets>
        <moduleSet>
            <useAllReactorProjects>true</useAllReactorProjects>
            <excludes>
                <exclude>*:test-distribution</exclude>
            </excludes>
            <sources>
                <includeModuleDirectory>false</includeModuleDirectory>
                <outputDirectory>sources</outputDirectory>
                <fileSets>
                    <fileSet>
                        <includes>
                            <include>src/**</include>
                        </includes>
                    </fileSet>
                </fileSets>
            </sources>
        </moduleSet>
    </moduleSets>
</assembly>
/sources
下是钻孔项目,而不仅仅是
src
文件夹,在
/src
下是源文件夹

我想要的是:

- test-distribution.zip
    - sources
         - main
         - test
如何更改
moduleSet/sources
目录的名称?

使用,并且可以更改源目录的名称:

<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">

    <id>distribution</id>
    <formats>
        <format>zip</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>

    <moduleSets>
        <moduleSet>
            <useAllReactorProjects>true</useAllReactorProjects>
            <excludes>
                <exclude>*:test-distribution</exclude>
            </excludes>
            <sources>
                <includeModuleDirectory>false</includeModuleDirectory>
                <fileSets>
                    <fileSet>
                        <includes>
                            <include>/**</include>
                        </includes>
                        <outputDirectory>sources</outputDirectory>
                        <directory>src</directory>
                    </fileSet>
                </fileSets>
            </sources>
        </moduleSet>
    </moduleSets>
</assembly>

应该这样做。这个选择很奇怪

<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">

    <id>distribution</id>
    <formats>
        <format>zip</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>

    <moduleSets>
        <moduleSet>
            <useAllReactorProjects>true</useAllReactorProjects>
            <excludes>
                <exclude>*:test-distribution</exclude>
            </excludes>
            <sources>
                <includeModuleDirectory>false</includeModuleDirectory>
                <fileSets>
                    <fileSet>
                        <includes>
                            <include>/**</include>
                        </includes>
                        <outputDirectory>sources</outputDirectory>
                        <directory>src</directory>
                    </fileSet>
                </fileSets>
            </sources>
        </moduleSet>
    </moduleSets>
</assembly>