首页 > 解决方案 > Maven 没有像我预期的那样替换

问题描述

我在 pom.xml 中定义了一些配置文件,以便使资源映射依赖于操作系统。它第一次工作(一周前),但现在在 git clone 之后,它停止了工作。

这是我的 pom.xml 个人资料:

<profile>
    <id>windows</id>
    <activation>
        <os>
            <family>dos</family>
        </os>
    </activation>
    <properties>
        <file.mapping>file:///C:/software/photos/</file.mapping>
    </properties>
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>
</profile>

这是我遇到麻烦的地方:

<mvc:resources mapping="/photos/*" location="@file.mapping@"></mvc:resources>

这是“原始”行,我没有问题。它工作正常:

<mvc:resources mapping="/photos/*" location="file:///C:/software/photos/"></mvc:resources>

它似乎做了一个替换,maven install 和所有这些都没有问题。但是第一行不起作用。我知道这里发生了什么。在 Linux 中工作正常。

标签: javamavenweb-applications

解决方案


推荐阅读