Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.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
汇编插件可以';t复制Java运行时映像_Java_Maven_Maven Assembly Plugin - Fatal编程技术网

汇编插件可以';t复制Java运行时映像

汇编插件可以';t复制Java运行时映像,java,maven,maven-assembly-plugin,Java,Maven,Maven Assembly Plugin,我正在使用汇编插件将JRT(Java运行时映像)和一些应用程序资源聚合到最终用户分发版中。用法非常简单: pom.xml <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution>

我正在使用汇编插件将JRT(Java运行时映像)和一些应用程序资源聚合到最终用户分发版中。用法非常简单:

pom.xml

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <executions>
        <execution>
            <id>assembly-win64</id>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
            <configuration>
                <outputDirectory>dist/win64</outputDirectory>
                <descriptors>
                    <descriptor>src/main/assembly/windows.xml</descriptor>
                </descriptors>
            </configuration>
        </execution>
    </executions>
</plugin>
<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">

    <id>windows</id>
    <formats>
        <format>dir</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>

    <fileSets>
        ... more resources
        <fileSet>
            <directory>target/runtime-images/win64</directory>
            <outputDirectory>app</outputDirectory>
        </fileSet>
    </fileSets>

</assembly>
没有复制尝试,没有错误,什么都没有。我如何知道路径是正确的?因为如果我把一些垃圾文件放在同一个目录(而不是JRT映像)中,一切都会很顺利

我使用Windows,因此似乎不需要特定的文件权限


还有其他人面临过同样的问题吗?或者有没有Maven替代的汇编插件?

哇,我发现了问题所在。这不是很明显,所以我把它贴在这里,也许它曾经帮助过别人

我已经在父pom中声明了所有插件。没有配置,只有版本,所以我不必在每个子模块中指定插件版本

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>${plugin.assembly.version}</version>
        </plugin>
        <plugin>
            <groupId>org.moditect</groupId>
            <artifactId>moditect-maven-plugin</artifactId>
            <version>${plugin.moditect.version}</version>
        </plugin>
    </plugins>
</build>

org.apache.maven.plugins
maven汇编插件
${plugin.assembly.version}
org.moditect
moditectmaven插件
${plugin.moditect.version}
然后在子模块中,我使用了这些插件,以便执行它们

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
            ... configuration
            </executions>
        </plugin>
        <plugin>
            <groupId>org.moditect</groupId>
            <artifactId>moditect-maven-plugin</artifactId>
            <executions>
            ... configuration
            </executions>
        </plugin>
    </plugins>
</build>

org.apache.maven.plugins
maven汇编插件
... 配置
org.moditect
moditectmaven插件
... 配置
但Maven继承了父pom的插件顺序。 我从没想到这件事会这么愚蠢

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
            ... configuration
            </executions>
        </plugin>
        <plugin>
            <groupId>org.moditect</groupId>
            <artifactId>moditect-maven-plugin</artifactId>
            <executions>
            ... configuration
            </executions>
        </plugin>
    </plugins>
</build>