使用jetty时运行资源过滤器: [英] Running resource filters when using jetty:run

查看:126
本文介绍了使用jetty时运行资源过滤器:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在基于配置文件在jsps上使用资源过滤.我也在使用mvn jetty:run在本地进行开发,但是过滤阶段无法运行.

I'm using resource filtering on jsps, based on profiles. I'm also developing locally using mvn jetty:run, but the filtering phase does not run.

如何使用码头插件执行过滤?

How can I perform filtering using the jetty plugin?

配置摘要:

<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>  

推荐答案

您可能要使用jetty:run爆炸目标,而不是jetty:run.来自文档:

You may want to use the jetty:run-exploded goal rather than jetty:run. From the documentation:

此目标首先将您的Web应用程序组装到爆炸的War文件中,然后将其部署到Jetty.

This goal first assembles your webapp into an exploded war file and then deploys it to Jetty.

这可以确保在启动服务器之前执行适当的战争生命周期阶段.

This may ensure that the appropriate war lifecycle phases are executed before the server is started.

您还确定jci配置文件已被激活吗?如果为构建指定了另一个配置文件,则< activeByDefault>属性不会启用该配置文件,有关详细信息,请参见此错误.

Also are you sure the jci profile is being activated? if another profile is specified for the build, the <activeByDefault> property won't enable the profile, see this bug for details.

根据约翰·凯西​​的回答:

From John Casey's response:

上面的示例正在按设计工作. < activeByDefault/>元素的目的是指定如果构建中没有其他配置文件处于活动状态,则将激活此配置文件.因此,任何配置文件的特定激活都将导致该配置文件被停用.

The above example is working as designed. The <activeByDefault/> element is meant to specify that this profile will be activated if no other profiles are active in the build. Therefore, specific activation of any profile will cause this one to be deactivated.

这篇关于使用jetty时运行资源过滤器:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆