Maven:无法删除已过滤的资源

时间:2017-10-28 17:23:36

标签: maven pom.xml maven-assembly-plugin maven-resources-plugin maven-clean-plugin

在我的pom.xml中,我会过滤一些资源并将输出目录(" asciidoc-filtered")设置到我的/target文件夹中的文件夹:/target/asciidoc-filtered

经过一些构建步骤后,我想删除这个" asciidoc-filtered" maven-clean-plugin的文件夹。我基本上可以处理插件并删除其他一些东西,但我无论如何都无法删除文件夹" asciidoc-filtered"。

以下是POM的摘录:

...
    <build>
        <resources>
            <resource>
                <directory>src/main/asciidoc</directory>
                <targetPath>${project.build.directory}/asciidoc-filtered</targetPath>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>1.5.6</version>
                <executions>
                    <execution>
                        <id>generate-html</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <sourceDirectory>${project.build.directory}/asciidoc-filtered</sourceDirectory>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                            <backend>html5</backend>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptor>src/main/resources/assembly.xml</descriptor>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <configuration>
                    <excludeDefaultDirectories>true</excludeDefaultDirectories>
                    <filesets>
                        <fileset>
                            <directory>${project.build.directory}</directory>
                            <includes>
                                <include>**/*</include>
                            </includes>
                            <excludes>
                                <exclude>*.jar</exclude>
                                <exclude>*.zip</exclude>
                                <exclude>*.html</exclude>
                            </excludes>
                        </fileset>
                    </filesets>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
...

所以没有 maven-clean-plugin,我的/target看起来像这样:

enter image description here

maven-clean-plugin,我的/target看起来像这样:

enter image description here

想要实现的目标是这样的:

enter image description here

有什么想法,为什么它不起作用? 或任何解决方案,如何使其工作?

提前多多感谢; - )

0 个答案:

没有答案
相关问题