title

fire chief's random developer tidbits

Friday, February 4, 2011

Wicket deployment vs. development mode with Maven build

pom.xml:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
                ...
                <webResources>
                    <webResource>
                        <directory>${basedir}/src/main/webapp/WEB-INF</directory>
                        <includes>
                            <include>web.xml</include>
                        </includes>
                        <targetPath>WEB-INF</targetPath>
                        <filtering>true</filtering>
                    </webResource>
                </webResources>
            </configuration>
        </plugin>

   ...
  <profiles>
      <profile>
          <id>dev</id>
          <properties>
              <wicketconfig>development</wicketconfig>
          </properties>
          <activation>
              <activeByDefault>true</activeByDefault>
          </activation>
      </profile>
      <profile>
          <id>release</id>
          <properties>
              <wicketconfig>deployment</wicketconfig> <!-- variable in web.xml -->
          </properties>
      </profile>
  </profiles>


web.xml:

    <filter>
        <filter-name>WicketApplication</filter-name>
        <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
        <init-param>
            <param-name>applicationClassName</param-name>
            <param-value>com.rootAppClassNameGoesHere</param-value>
        </init-param>
        <init-param>
            <param-name>configuration</param-name>
            <param-value>${wicketconfig}</param-value>
        </init-param>
    </filter>

No comments:

Post a Comment