Thanks Tim and Stephen...
-Amaresh

On Thu, Apr 14, 2011 at 5:30 PM, Stephen Connolly <
stephen.alan.conno...@gmail.com> wrote:

> BUT if you have specified a configuration using a fixed value, then
> that default property will be ignored so if you have
>
>            <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-compiler-plugin</artifactId>
>                <version>2.0.2</version>
>                <configuration>
>                    <source>1.6</source>
>                    <target>1.6</target>
>                </configuration>
>            </plugin>
>
> Then the property will not be considered
>
> if you have
>
> <properties>
> <maven.compiler.source>1.6</maven.compiler.source>
> </properties>
> ...
>             <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-compiler-plugin</artifactId>
>                <version>2.0.2</version>
>                <configuration>
>                     <source>${maven.compiler.source}</source>
>                     <target>1.6</target>
>                </configuration>
>            </plugin>
>
> then the property will be defaulted but can be overiden from the command
> line.
>
> On 14 April 2011 11:42, Tim Kettler <tim.kett...@udo.edu> wrote:
> > Hi,
> >
> > you can look that up in the documentation of the goal [1]. If an
> expression
> > is defined for a parameter that is what you can use as a property on the
> > commandline. In your example: -Dmaven.compiler.source=1.5
> >
> > -Tim
> >
> > [1]
> http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html
> >
> > Am 14.04.2011 12:16, schrieb amaresh mourya:
> >>
> >> Hi,
> >>
> >> How do I override compiler source to be used If I run mvn
> compiler:compile
> >> from the command line.
> >>
> >> Compiler:compile goal has parameter called source. Doesn't that mean If
> I
> >> run
> >> [ mvn compiler:compile -Dsource=1.5 ] it should use 1.5 instead of 1.6?
> >>
> >> My POM is like :
> >>
> >> <?xml version="1.0" encoding="UTF-8" ?>
> >> <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>org.apache.maven.plugins</groupId>
> >>                 <artifactId>maven-compiler-plugin</artifactId>
> >>                 <version>2.0.2</version>
> >>                 <configuration>
> >>                     <source>1.6</source>
> >>                     <target>1.6</target>
> >>                 </configuration>
> >>             </plugin>
> >>       </plugins>
> >>    </build>
> >> </project>
> >>
> >>
> >> thanks
> >> --Amaresh
> >>
> >> On Thu, Apr 14, 2011 at 3:22 PM, Stephen Connolly<
> >> stephen.alan.conno...@gmail.com>  wrote:
> >>
> >>> 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<amaresh.mou...@gmail.com>
>  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: users-unsubscr...@maven.apache.org
> > For additional commands, e-mail: users-h...@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to