3

当我做 jetty:run ... 正确的战争过滤器。当我打包时......由此产生的战争没有正确过滤。我究竟做错了什么?

  <build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
            <includes>
                <include>**/*.properties</include>
                <include>**/*.xml</include>
            </includes>
        </resource>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>false</filtering>
            <excludes>
                <exclude>**/*.properties</exclude>
                <exclude>**/*.xml</exclude>
            </excludes>
        </resource>
    </resources>
    <finalName>MyWarName</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.1</version>
            <configuration>
                <source>${jdk.source}</source>
                <target>${jdk.target}</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <configuration>
                <contextXml>${basedir}/src/main/webapp/WEB-INF/jetty-context.xml</contextXml>
            </configuration>

        </plugin>
    </plugins>
</build>
4

1 回答 1

0

您需要添加未被替换的属性:

系统属性

项目属性:

<project>
...
<properties>
    <the_name>value</value>
</properties>
...
</project>

使用 .properties 文件构建过滤器:

<project>
...
<build>
    <filters>
        <filter>the_values.properties</filter>
    </filters>
</build>
...
</project>
于 2014-02-20T23:41:06.247 回答