You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Todd Huss <th...@greatschools.net> on 2005/02/25 02:53:07 UTC
Log4J and JUnit in Maven
I have my junit tests setup to fork (maven.junit.fork=true) which causes all
log4j INFO and above messages to go to STDOUT when my build process starts
running the unit tests.
I have my build process copy log4j.properties over to target/classes (so
it's in the classpath). What's the next step I should take to get my unit
tests to pick up my log4j.properties? Just putting it in the classpath does
not seem to be enough.
Ideally I'd like to set something in project.properties so that every time I
run my build it uses my log4j.properties.
Thanks for the help!
-Todd
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Log4J and JUnit in Maven
Posted by Oscar Picasso <os...@yahoo.com>.
Hi Tood,
Here is what I have done.
I have put log4j.properties in <basedir>/src/conf/
On project.xml:
...
<build>
...
<sourceDirectory>src/java</sourceDirectory>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
<unitTest>
<includes>
<include>**/AllTests.java</include>
</includes>
<resources>
...
<resource>
<directory>src/conf</directory>
<includes>
<include>log4j.properties</include>
</includes>
</resource>
</resources>
</unitTest>
</build>
...
That way when running the test, maven copies the log4.properties in the
test-classes directory and you don't have to do anything special with the
classpath.
It works for me.
It does look very different from what you are already doing (with the
difference that you copy your log4j.properties in <classes> instead of
<test-classes>, so I don't know why it doesn't work for you?
Oscar
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org