If anyone is interested, here's how I solved the problem of building a Wicket
1.3-compatible JAR and 1.4-compatible JAR from the same codebase.

First I tweaked my Wicket code so that it could compile under 1.3 and 1.4.
Basically, I started with 1.4 code, then removed generics, and avoided using
get/setDefaultModel.

Then I added build profiles to my POM (see below). I can now use the build
profiles to compile and deploy JARs for both 1.3 and 1.4, using maven's
<classifier> to distinguish the two JARs.

<profiles>
  <profile>
    <id>wicket14</id>
    <activation>
      <activeByDefault>true</activeByDefault>
    </activation>
    <properties>
      <wicket.version>1.4.3</wicket.version>
    </properties>
    <build>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <classifier>wicket14</classifier>
          </configuration>
        </plugin>
      </plugins>
    </build>
  </profile>
  <profile>
    <id>wicket13</id>
    <activation>
      <property>
        <name>wicket13</name>
      </property>
    </activation>
    <properties>
      <wicket.version>1.3.6</wicket.version>
    </properties>
    <build>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <classifier>wicket13</classifier>
          </configuration>
        </plugin>
      </plugins>
    </build>
  </profile>
</profiles>


mbrictson wrote:
> 
> Hello,
> 
> I am writing a Wicket component that I would like to use in two different
> Wicket applications. One application is using Wicket 1.4.3, and the other
> is a legacy application using Wicket 1.3.6. Unfortunately upgrading this
> legacy app to 1.4 is not an option.
> 
> I'm using maven for my build process. Right now I am considering the
> following approach:
> 
> 1. Set up a multi-module maven project.
> 
> 2. Create a "common" module that contains all the code that will safely
> execute in both Wicket 1.3 and Wicket 1.4.
> 
> 3. Create a "wicket13" module that contains the 1.3-specific code.
> 
> 4. Create a "wicket14" module that contains the 1.4-specific code.
> 
> That sounds like a lot of trouble. Can anyone think of a simpler solution,
> perhaps using maven build profiles? Or am I approaching this completely
> wrong?
> 
> --
> Matt
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-compile-a-component-for-both-Wicket-1.3-and-1.4--tp26413392p26419338.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to