[slf4j-dev] Unit tests in slf4j-ext and Maven

Thorbjørn Ravn Andersen ravn at runjva.com
Thu Oct 2 21:15:12 CEST 2008


Ceki Gulcu skrev:
> Thorbjørn Ravn Andersen wrote:
>
>   
>> I'm trying to get unit tests up and running in Maven for the agent, but 
>> I am unfamiliar with the Maven way of doing things, so I'd appreciate 
>> some comments.
>>
>> I've figured out how to use the <argLine> tag to get "-javaagent:foobar" 
>> put in the right place of the surefire invocation, but unfortunately it 
>> is a hard requirement that the _jar_file is used, and it appears to me 
>> that the test-phase is before the jar-file is built, so it is not even 
>> available at that time.
>>
>> Is there a good way to run unit tests after the jar file is built, and 
>> how do I refer to the jar file in pom.xml?  
>>     
>
> Hello Thorbjørn,
>
> It is quite difficult to get Maven to do things it is not designed for, at least 
> not out of the box. I do not know how to run unit tests after the jar is built. 
> Usually, the jar is built, only if the tests pass. (Tests always come before the 
> packaging.) For the various Maven2 test phases, see
>
>    http://cvs.peopleware.be/training/maven/maven2/buildLifecyclePhases.html
>
> We could run the test after the packaging phase, for example during the 
> "integration-test" phase. I'll see what I can do.
>
>   
I read up a bit on this.  It appears that maven-surefire-plugin cannot 
both do unit tests and integration tests in the same life cycle (as far 
as I understood).

Oh the joy of other peoples tools :)
> On a related note, the addition of 
> <argLine>-javaagent:${project.build.outputDirectory}=time</argLine>
> seems to cause Continuum to fail. Here is the error message:
>
>   
That is because it is wrong (not a valid zip file), and I can see that I 
have removed that line in my local copy.  My bad. Duly updated.  
Shouldn't Continuum tell me that I broke the build?

Also it confused me a bit in the beginning to see stack traces in the 
maven output, but apparently that is intentional.  I am not used to such 
verbosity when tests actually pass :)

/Thorbjørn





More information about the slf4j-dev mailing list