Using Ant's if task for this is not the proper "Maven" approach...
Instead, use profiles.

http://maven.apache.org/guides/introduction/introduction-to-profiles.html

Wayne

On Mon, Sep 8, 2008 at 11:56 PM, Carlos Alonso <[EMAIL PROTECTED]> wrote:
> Hi All.
>
> I have the following situation: I have two maven properties that should
> take a value or another depending on a boolean given from command line
> and I don't know how to achieve it.
> I'm trying to achieve this by using the following ant task:
> <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-antrun-plugin</artifactId>
>                <dependencies>
>                    <dependency>
>                        <groupId>ant-contrib</groupId>
>                        <artifactId>ant-contrib</artifactId>
>                        <version>1.0b2</version>
>                    </dependency>
>                </dependencies>
>                <executions>
>                    <execution>
>                        <phase>validate</phase>
>                        <configuration>
>                            <tasks>
>                                <taskdef name="if"
> classname="net.sf.antcontrib.logic.IfTask"
> classpathref="maven.plugin.classpath" />
>
>                                <if>
>                                    <equals
> arg1="${variable_from_command_line}" arg2="true" />
>                                    <then>
>                                         <property name="property1"
> value="val1 "/>
>                                         <property name="property2"
> value="val2 "/>
>                                    </then>
>
>                                    <else>
>                                         <property name="property1"
> value="val3 "/>
>                                         <property name="property2"
> value="val4 "/>
>                                    </else>
>                                </if>
>                            </tasks>
>                        </configuration>
>                        <goals>
>                            <goal>run</goal>
>                        </goals>
>                    </execution>
>                </executions>
>            </plugin>
> Properties seem to be set up successfully but only seem to be available
> within the ant task execution, but not exported to the maven one.
> Any input?
>
> Thanks in advance.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to