Am Freitag, 5. Februar 2010 07:45:51 schrieb Søren Krogh Neigaard: > Thank you all for your answers > > I tried adding the following to my pom.xml > > <properties> > <database.driver>oracle.jdbc.OracleDriver</database.driver> > <database.url>${database.url}</database.url> > <database.username>${database.username}</database.username> > <database.password>${database.password}</database.password> > </properties> > > And tried reading with System.getProperty("database.username"), but it gave > me null. > > The reason for the ${database.url} and so on, is that it gets its values > from either a default settings.xml or a user specific settings.xml, and > that is how I need it to be.
It's as Anders wrote already. If you want to use the same property names in settings.xml and pom.xml you have to put them in a profile, that's how I do it and it works. The profile could be <activeByDefault> if you prefer. So your settings.xml could look like this: <settings> <profiles> <profile> <id>someProf</id> <activation> <activeByDefault/> </activation> <properties> <database.url>someUrl</database.url> </properties> </profile> </profiles> </settings> And your pom.xml would be this: <project> ... <properties> <database.url>someDummyValue</database.url> </properties> </project> Now reading the properties via System.getProperty("database.url") shoud work. hth, - martin
signature.asc
Description: This is a digitally signed message part.