Well it seems that I use 2.4.3, so I have changed it to the now deprecated way 
also. It still gives me null values... :(

I think my problem is elsewhere now, I do not think maven gets activated when I 
run my junit tests. I will look into this issue now.

Med venlig hilsen / Kind regards 


Søren Krogh Neigaard
Systems Engineer

Søren Frichs Vej 39, 8000 Aarhus C
Denmark 

Mobile +4541965252
soeren.krogh.neiga...@systematic.com
www.systematic.com


-----Original Message-----
From: Martin Höller [mailto:mar...@xss.co.at] 
Sent: 5. februar 2010 11:01
To: Maven Users List
Subject: Re: Read properties from pom.xml from Java

Am Freitag, 5. Februar 2010 09:50:04 schrieb Søren Krogh Neigaard:
> Im getting grey hairs :)
>
> I tried with this in my pom.xml:
>
> <plugin>
>   <groupId>org.apache.maven.plugins</groupId>
>   <artifactId>maven-surefire-plugin</artifactId>
>   <version>2.5</version>
>   <configuration>
>     <systemPropertyVariables>
>       <db.driver>oracle.jdbc.OracleDriver</db.driver>
>       <db.url>${database.url}</db.url>
>       <db.username>${database.username}</db.username>
>       <db.password>${database.password}</db.password>
>     </systemPropertyVariables>
>   </configuration>
> </plugin>

That's almost exactly how I do it. The differences are:
- I'm still using surefire 2.4.2
- Due to the older version I use the (now) deprecated method of defining
  system properties in surefire (<systemProperties> instead of
  <systemPropertyVariables>)

How and where are you trying to access the properties? In some JUnit test which 
is executed by the maven surefire plugin via System.getProperty("db.url")? That 
definitely works for me.

However, Stephen's comments about locking you to maven this way sounds 
reasonable. His approach is probably the better one. But I don't know yet how 
these properties could be used in pom.xml for plugin configuration. Do they get 
imported by maven somehow?


hth,
- martin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to