Could somebody explain me the differences between these two resource definitions? Why the jar files are excluded but in the second resource included? I don't understand these two declarations:
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.jar</exclude>
<exclude>myDummyPath/war/l10n/*.*</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</resources>
The first difference is obviously the paths:
<excludes>
<exclude>**/*.jar</exclude>
<exclude>myDummyPath/war/l10n/*.*</exclude>
</excludes>
And:
<includes>
<include>**/*.jar</include>
</includes>
Obviously the first declaration excludes all .jar
files and everything under I10n
. The second path, on the other, includes only .jar
files.
Next the first declaration enables filtering and the second disables it. In maven, filtering (by default) replaces all variable placeholders ${...}
with their values - for more information read the documentation .
So in the first declaration, all resources except .jar
files and localisation files, are filtered by maven - substitution in values for placeholders such as ${project.name}
.
In the second declaration, all .jar
resources are copied over, without filtering.
Look at the different filtering
settings. The author wants Maven to replace placeholders in some files (maybe config files) but not to break binary jar files.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.