Maven: deleted files (antrun) are still in the final war file

I use the antrun plugin to delete and move some property files depending on the profile used:

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
    <execution>
        <phase>compile</phase>
        <goals>
            <goal>run</goal>
        </goals>
        <configuration>
            <tasks>
                <delete>
                    <fileset dir="${project.build.outputDirectory}/com/.../props">
                        <exclude name="pm-web-${profile.id}.xml" />
                    </fileset>
                </delete>
                <move file="${project.build.outputDirectory}/com/.../props/pm-web-${profile.id}.xml"
                    tofile="${project.build.outputDirectory}/com/.../props/pm-web.xml" />
            </tasks>
        </configuration>
    </execution>
</executions>

When I check the target / classes folder, I see that the “unnecessary” property files were deleted correctly and that the move task also completed correctly. However, when I look at the built-in war file, I see that the deleted files are still there (the moved file is ok in the war).

I do not understand how this is possible; I assume the war plugin basically splits the target folder? Since the files were correctly deleted from the target folder, I would expect that they, too, would not enter the war.

(), , , : ( ) " ".

( ), , , .

,

+3
2

mojo webapp ${project.build.directory}/${project.build.finalName} .war-. , antrun. target/classes ${project.build.directory}/${project.build.finalName}, .war. , , , . , , .

+1

<phase>compile</phase>

<phase>prepare-package</phase>
0

Source: https://habr.com/ru/post/1733909/


All Articles