在父本的pom.xml中的定义
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<application.url>http://have.cn:8080/have-project</application.url>
<application.static.url>http://have.cn:8080/have-project</application.static.url>
<application.static.url.for_resources>http://have.cn:8080/have-project</application.static.url.for_resources>
</properties>
</profile>
在子中的pom.xml中
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<resourceEncoding>UTF-8</resourceEncoding>
<!-- <escapeString>\</escapeString> -->
<webResources>
<resource>
<directory>src/main/webapp</directory>
<filtering>true</filtering>
<includes>
<include>**/*.jsp</include>
<include>**/*.tag</include>
<include>**/*.css</include>
</includes>
<targetPath></targetPath>
</resource>
<resource>
<directory>src/main/webapp/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.css</include>
<include>**/*.js</include>
</includes>
<targetPath>resources</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
我将maven打包好后在tomcat下运行,可就是在.js,和.css文件中找不到我在profiles properties下配置的<application.url>http://have.cn:8080/have-project</application.url>
<application.static.url>http://have.cn:8080/have-project</application.static.url>
<application.static.url.for_resources>http://have.cn:8080/have-project</application.static.url.for_resources>这些,按理说这配好后,使用通配符${}是可以解析的!但我这解析不到,请大神指点!