You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bin Lan <la...@gmail.com> on 2011/11/07 15:18:19 UTC

contextFile does not work with profiles?

Hi All,

I am trying to use tomcat maven plugin with different profiles to get
different JNDI parameters so I can connect to different database. But the
plugin seems to ignore the <contextFile> on the profile section. Here is
some snapshots of my configuration:

    <profiles>
        <profile>
            <id>production</id>
            <activation><activeByDefault>true</activeByDefault></activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-war-plugin</artifactId>
                        <configuration>

<containerConfigXML>${basedir}WebContent/META-INF/production/context.xml</containerConfigXML>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.tomcat.maven</groupId>
                        <artifactId>tomcat6-maven-plugin</artifactId>
                        <configuration>

<contextFile>WebContent/WEB-INF/production/context.xml</contextFile>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>staging</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-war-plugin</artifactId>
                        <configuration>

<containerConfigXML>WebContent/META-INF/staging/context.xml</containerConfigXML>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.tomcat.maven</groupId>
                        <artifactId>tomcat6-maven-plugin</artifactId>
                        <configuration>

<contextFile>WebContent/WEB-INF/staging/context.xml</contextFile>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>development</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-war-plugin</artifactId>
                        <configuration>

<containerConfigXML>WebContent/META-INF/development/context.xml</containerConfigXML>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.tomcat.maven</groupId>
                        <artifactId>tomcat6-maven-plugin</artifactId>
                        <configuration>

<contextFile>WebContent/WEB-INF/development/context.xml</contextFile>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>


Here is for tomcat plugin:

              <plugin>
                  <groupId>org.apache.tomcat.maven</groupId>
                  <artifactId>tomcat6-maven-plugin</artifactId>
                  <version>2.0-SNAPSHOT</version>
                  <configuration>

<warSourceDirectory>${basedir}/WebContent</warSourceDirectory>
                      <contextReloadable>true</contextReloadable>
                  </configuration>
            </plugin>


Any suggestions?

Regards
Bin

Re: contextFile does not work with profiles?

Posted by Bin Lan <la...@gmail.com>.
Hi All,

Sorry, please ignore this, the option is working. I put the wrong path.

Regards
Bin



On Mon, Nov 7, 2011 at 9:18 AM, Bin Lan <la...@gmail.com> wrote:

> Hi All,
>
> I am trying to use tomcat maven plugin with different profiles to get
> different JNDI parameters so I can connect to different database. But the
> plugin seems to ignore the <contextFile> on the profile section. Here is
> some snapshots of my configuration:
>
>     <profiles>
>         <profile>
>             <id>production</id>
>
> <activation><activeByDefault>true</activeByDefault></activation>
>             <build>
>                 <plugins>
>                     <plugin>
>                         <groupId>org.apache.maven.plugins</groupId>
>                         <artifactId>maven-war-plugin</artifactId>
>                         <configuration>
>
> <containerConfigXML>${basedir}WebContent/META-INF/production/context.xml</containerConfigXML>
>                         </configuration>
>                     </plugin>
>                     <plugin>
>                         <groupId>org.apache.tomcat.maven</groupId>
>                         <artifactId>tomcat6-maven-plugin</artifactId>
>                         <configuration>
>
> <contextFile>WebContent/WEB-INF/production/context.xml</contextFile>
>                         </configuration>
>                     </plugin>
>                 </plugins>
>             </build>
>         </profile>
>         <profile>
>             <id>staging</id>
>             <build>
>                 <plugins>
>                     <plugin>
>                         <groupId>org.apache.maven.plugins</groupId>
>                         <artifactId>maven-war-plugin</artifactId>
>                         <configuration>
>
> <containerConfigXML>WebContent/META-INF/staging/context.xml</containerConfigXML>
>                         </configuration>
>                     </plugin>
>                     <plugin>
>                         <groupId>org.apache.tomcat.maven</groupId>
>                         <artifactId>tomcat6-maven-plugin</artifactId>
>                         <configuration>
>
> <contextFile>WebContent/WEB-INF/staging/context.xml</contextFile>
>                         </configuration>
>                     </plugin>
>                 </plugins>
>             </build>
>         </profile>
>         <profile>
>             <id>development</id>
>             <build>
>                 <plugins>
>                     <plugin>
>                         <groupId>org.apache.maven.plugins</groupId>
>                         <artifactId>maven-war-plugin</artifactId>
>                         <configuration>
>
> <containerConfigXML>WebContent/META-INF/development/context.xml</containerConfigXML>
>                         </configuration>
>                     </plugin>
>                     <plugin>
>                         <groupId>org.apache.tomcat.maven</groupId>
>                         <artifactId>tomcat6-maven-plugin</artifactId>
>                         <configuration>
>
> <contextFile>WebContent/WEB-INF/development/context.xml</contextFile>
>                         </configuration>
>                     </plugin>
>                 </plugins>
>             </build>
>         </profile>
>     </profiles>
>
>
> Here is for tomcat plugin:
>
>               <plugin>
>                   <groupId>org.apache.tomcat.maven</groupId>
>                   <artifactId>tomcat6-maven-plugin</artifactId>
>                   <version>2.0-SNAPSHOT</version>
>                   <configuration>
>
> <warSourceDirectory>${basedir}/WebContent</warSourceDirectory>
>                       <contextReloadable>true</contextReloadable>
>                   </configuration>
>             </plugin>
>
>
> Any suggestions?
>
> Regards
> Bin
>
>