I've searched the archives for this but no luck -

I need to build my web.xml file with specific values based on the target
environment for which I'm performing the build.   Therefore, I'd like maven
to perform some variable substitution when I run the mvn install goal.  I'm
trying to use profiles for this (though I obviously lack solid
understanding of profiles at this point).  Here is what I did:


I've setup 3 profiles in the parent  pom.xml file like this:

  <profiles>
      <profile>
            <id>dev</id>
            <activation>
                  <activeByDefault>true</activeByDefault>
            </activation>
        <properties>
            <app.context.parm>dev_values...</app.context.parm>
        </properties>
      </profile>
      <profile>
            <id>qa</id>
            <properties>
            <app.context.parm>qa_values...</app.context.parm>
        </properties>
      </profile>
      <profile>
            <id>prod</id>
            <properties>
             <app.context.parm>prod_values...</app.context.parm>
        </properties>
      </profile>
  </profiles>


In my web.xml file I currently have something like this:

      <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>${app.context.parm}</param-value>  <-- need the
variable substitution HERE...
      </context-param>

I then run mvn -Pqa install goal, hoping that maven will insert the proper
application context values into this placeholder based on the profile
that's active, but so far this does not work for me...   please tell me
what else I'm missing to make this work.

Thanks,
James

Reply via email to