我正在基于配置文件在jsps上使用资源过滤.我也在使用本地开发mvn jetty:run,但过滤阶段不会运行.
如何使用jetty插件执行过滤?
配置片段:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<webResources>
<resource>
<directory>src/main/webapp</directory>
<includes>
<include>error.jsp</include>
</includes>
<filtering>true</filtering>
<targetPath>/</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
<profile>
<id>jci</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>jci</name>
</property>
</activation>
<properties>
<error.title>Some value here</error.title>
</properties>
</profile>
Run Code Online (Sandbox Code Playgroud)
您可能想要使用jetty:run-explosion目标而不是jetty:run.从文档:
此目标首先将您的webapp组装成爆炸的war文件,然后将其部署到Jetty.
这可以确保在服务器启动之前执行适当的战争生命周期阶段.
您还确定jci配置文件正在激活吗?如果为构建指定了另一个配置文件,则<activeByDefault>属性将不启用该配置文件,有关详细信息,请参阅此错误.
来自John Casey的回应:
以上示例按设计工作.<activeByDefault />元素用于指定在构建中没有其他配置文件处于活动状态时将激活此配置文件.因此,任何配置文件的特定激活将导致该配置文件被停用.
| 归档时间: |
|
| 查看次数: |
3455 次 |
| 最近记录: |