what you can do in that case is define properties in the pom and use
those properties to define the default-cli values.

properties set via the CLI override properties declared in the POM.

 <project xmlns="http://maven.apache.org/POM/4.0.0";>
    <modelVersion>4.0.0</modelVersion>
    <groupId>Application6</groupId>
    <artifactId>mavenProj</artifactId>
    <version>1.0-SNAPSHOT</version>
    <description>Project for mavenProj</description>
    <properties>
       <greetings>welcome</greetings>
       <person>chandan</person>
    </properties>
    <build>
        <plugins>
         <plugin>
                <groupId>MyPlugins</groupId>
                <artifactId>hiPlugin</artifactId>
                <version>1.0</version>
                <executions>
                    <execution>
                       <id>default-cli</id>
                        <goals>
                            <goal>hi</goal>
                        </goals>
                         <configuration>
                             <greetings>${greetings}</greetings>
                             <person>${person}</person>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
 <pluginRepositories>
 ....
 </pluginRepositories>
 </project>

Note that the property names do not have to be the same as the
<code>@parameter expression="${myplugin.greeting}"</code> style
default properties you specified in your mojo, but usually you would
keep them the same... unless you are relying on those properties for
the lifecycle-invoked goals

-Stephen

On 14 April 2011 10:28, amaresh mourya <[email protected]> wrote:
> Hi All,
>
> I have a POM which has a plugin. I have configured it to use some specific
> settings at the time of command line invocation of the goal. I set these
> configurations in execution ID as "default-cli".
>
> This MyPlugins:hiPlugin:1.0:hi goals just prints the output in format of :
> ${person} says ${greetings}
> When I ran goal (MyPlugins:hiPlugin:1.0:hi) on command line I got the
> expected output that was : "Chandan says Welcome"
> But My question is why am I not able to override these configurations from
> command line, I wanted to run goal with parameter (MyPlugins:hiPlugin:1.0:hi
> -Dperson=Vishal) to get the output as "Vishal says Welcome". But I am still
> getting output "Chandan says Welcome".
>
> Here is my POM.
>
> <project xmlns="http://maven.apache.org/POM/4.0.0";>
>    <modelVersion>4.0.0</modelVersion>
>    <groupId>Application6</groupId>
>    <artifactId>mavenProj</artifactId>
>    <version>1.0-SNAPSHOT</version>
>    <description>Project for mavenProj</description>
>    <build>
>        <plugins>
>         <plugin>
>                <groupId>MyPlugins</groupId>
>                <artifactId>hiPlugin</artifactId>
>                <version>1.0</version>
>                <executions>
>                    <execution>
>                       <id>default-cli</id>
>                        <goals>
>                            <goal>hi</goal>
>                        </goals>
>                         <configuration>
>                             <greetings>welcome</greetings>
>                             <person>chandan</person>
>                        </configuration>
>                    </execution>
>                </executions>
>            </plugin>
>        </plugins>
>    </build>
> <pluginRepositories>
> ....
> </pluginRepositories>
> </project>
>
>
> Thanks,
> Amaresh
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to