Yes I have looked at "better builds with maven".

The plugin is used to initialize a database. It reads directory to create
tables, constraints, ..., it drop each objects of the DB and so on. Each
developer has his own DB schema so his own settings to access this schema.
So it seems good to store these properties in settings.xml, isn't it ?
But when plexus injects these properties in my mojo, it doesn't resolve
them.
Is it the good method to store the properties in the settings.xml ? Do I
need to use filtering and properties file ?




2006/7/31, Stefan Magnus Landrø <[EMAIL PROTECTED]>:

You have to add databaseServer as a property in your plugin. What kind of
mojo is it? Have you had a look at better builds with maven?

"Olivier Catteau" <[EMAIL PROTECTED]> skrev 31.07.2006 15:58:01:

> Hi,
> I would like to be able to configure my plugin with properties that are
> stored in the settings.xml.
> Here is a piece of my settings.xml :
>
> <settings>
> ...
>     <profiles>
>         <profile>
>             <id>database-developer</id>
>             <activation>
>                 <property>
>                     <name>!database</name>
>                 </property>
>             </activation>
>             <properties>
>                 <databaseServer>ad_daf1</databaseServer>
>                 <databasePort>34105</databasePort>
>             </properties>
>         </profile>
>     </profiles>
> ...
> </settings>
>
>
> Here is a pom to test my plugin :
>
> <project>
>     <name>POM For test</name>
>     <build>
>         <plugins>
>             <plugin>
>                 <artifactId>maven-antrun-plugin</artifactId>
>                 <executions>
>                     <execution>
>                         <phase>compile</phase>
>                         <configuration>
>                             <tasks>
>                                 <echo>databaseServer :
> ${databaseServer}</echo>
>                              </tasks>
>
>                         </configuration>
>                         <goals>
>                             <goal>run</goal>
>                         </goals>
>                     </execution>
>                 </executions>
>             </plugin>
>             <plugin>
>                 <groupId>...</groupId>
>                 <artifactId>...</artifactId>
>                 <configuration>
>                     <databaseServer>${databaseServer}</databaseServer>
>                     <databasePort>${databasePort}</databasePort>
>                 </configuration>
>             </plugin>
>         </plugins>
>     </build>
> </project>
>
> If I execute my plugin, the ant task resolve the property
${databaseServer}.
> But, in my mojo, I inject these properties and  ${databaseServer} isn't
> resolved, so my attribute databaseServer equals "${databaseServer}".
> How can I do to resolve these properties in my mojo ? Do I need to
> explicitely use something like the plexus ExpressionEvaluator to resolve
> them (a piece of code may help me) ?
>
> Thanks
>
> Olivier


Reply via email to