hELLO erik,
  ok i got it by using ant:filterchain in a sample defined.. 
i used as substitution file for properties my project.properties..

i was curious on one thing though it could be off-topic since it's ant-related
question..
seems to me that filterchain works only when you copy files

if i put a token @DB_DRIVER@ in my source java file, will ant replace it
althought i am not copying files?

thanks and regards
 marco


On 8/10/05, Marco Mistroni <[EMAIL PROTECTED]> wrote:
> Hello Erik,
>  thanks again for your reply...
> Well, maybe i was not clear in what i wanted to do..
> here is explained..
> i have in mydir\conf  a file named openejb-conf.xml, which is as follows
> 
> .......
> <Connector id="Default JDBC Database">
>    JdbcDriver   com.mysql.jdbc.Driver
>    JdbcUrl      jdbc:mysql://localhost/menagerie
>    UserName    castor
>    Password    castor
> </Connector>
> ...........
> 
> I have also two other configuration files that contains same
> informations (jdbc url).
> 
> IN addition, i have an abstract dbunit test which is supposed to get a
> jdbc connection from the same database..
> 
> I am trying to run my app at home and @work, but i have two different
> databases (to make things more complicated..).
> So, between home and work i am trying to find a way to change as less
> informations as possible to get my application running
> 
> the first step was to define  maven.junit.properties for the above
> jdbc data, so that i don't have to modify my java code.
> And that worked fine.
> But then i realized that i would need to change also those config
> files mentioned above, so i tried to use the same approach (of getting
> properties from project.properties) which obviously didn't work.
> I tried to define an ant:property in my maven.xml for the two above,
> but that didn't work either since those files are NOT copied into my
> build directory..
> 
> Do you have any suggestion on how to achieve my goals (change or
> define properties in one place and have them substituted in both
> config files and java code?
> 
> thanx in advance and regards
>   marco
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On 8/9/05, Eric Giguère <[EMAIL PROTECTED]> wrote:
> > Hello again
> > I don,t think that you will be able to use the variable directly in the
> > property file thought. Only jelly scripts can have variables replaced by
> > their runtime value. Like the Ant properties, they get assigned only in
> > Ant scripts executed by Ant. Jelly variable are a little like the Ant
> > properties, except that the jelly vars. can have their value change over
> > time. Unlike properties (in Ant), these can have a value set but its
> > immutable after setting it.
> >
> > Jelly can be a little, well, complicated, especially if you embedded
> > Java code in expression. I've not figured out yet exactly all the rules
> > in jelly expressions, the jelly expression parser is a nasty beast...
> > But you can get around pretty easily.
> >
> > Maybe I've misguided you. If you need the value of that variable inside
> > a property file, you have to actually write this value in the property
> > file using Ant/Jelly code. Otherwise, if you put the variable name in
> > there (in the property file), the variable name will be the value of the
> > property.
> >
> > NP! Hope it does help you do what you need.
> > Eric.
> >
> >
> > Marco Mistroni wrote:
> >
> > >hello eric,
> > >  thanx for the tip.. beside, i have to learn jelly, but is it reasonablet
> > >to use a jelly variable my property s hould be in both java code
> > >and a config file?
> > >
> > >thanx and regards
> > > marco
> > >
> > >On 8/9/05, Eric Giguère <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > >>Hello Marco
> > >>For such a need, use the jelly variable.
> > >>What you would do typically is initiate your variable using the property
> > >>value, then you can modify its value. That would do the trick in runtime
> > >>but if you need to actually write this value in a property, check the
> > >>Ant <property> tag, that should allow you to write the value in your
> > >>property file.
> > >>
> > >>Hope it helps
> > >>Eric.
> > >>
> > >>Marco Mistroni wrote:
> > >>
> > >>
> > >>
> > >>>hello all,
> > >>>  i am building an application using Maven.
> > >>>I have defined some custom properties in project.properties,  and i
> > >>>can successfully retrieve them inside my java code using
> > >>>System.getPRoperteis.
> > >>>
> > >>>I was wondering however if maven can substitute properties defined
> > >>>inside project.properties also in normal configuration files.
> > >>>
> > >>>example:
> > >>>i have a config file called openejb.config  in which i have to define
> > >>>a datasource wiht url, username and password
> > >>>i need same informations also for my dbunit tests, so i have defined
> > >>>those 3passwords inside my project properteis.
> > >>>in my java code i use  System.getPRoperty("username") to get value
> > >>>
> > >>>
> > >>>from properties, but in my config file i have tried to do
> > >>
> > >>
> > >>>${username}
> > >>>
> > >>>hoping that during compiation/build maven would have substituted it
> > >>>with the value of the property username defined in project.properties
> > >>>
> > >>>But it didn't work...
> > >>>
> > >>>Is it possible to do that? if so, how?
> > >>>
> > >>>thanks in advance and regards
> > >>>marco
> > >>>
> > >>>---------------------------------------------------------------------
> > >>>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]
> > >>
> > >>
> > >>
> > >>
> > >
> > >---------------------------------------------------------------------
> > >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]
> >
> >
>

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

Reply via email to