tags:

views:

339

answers:

1

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?


Configuration snippets:

<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>
+1  A: 

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

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.

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:

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.

Rich Seller
THanks for the answer. I'll look into run-exploded. And yes, I'm sure that the profile is active, that's not the problem.
Robert Munteanu
`mvn jetty:run-exploded -Dmaven.test.skip=true` is a winner. Thanks!
Robert Munteanu
Sorry, spoke to soon. Neither jsp changes nor javarebel class reloading seem to take effect.
Robert Munteanu