You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by andy petrella <ap...@telemis.com> on 2009/03/25 14:42:48 UTC

Test built jar

Hi All,

I trying to have some IT tests (or look-like) on my jar file only. I was 
thinking that the phase verify will give me that chance but not.

Here is my problem.

I have a jar where some directory has to be parsed on a file pattern => 
I use the JarFile class, then parse it to retrieve what I need (some XML 
files).

This code must be tested (a lot !) but I can figure out how to have my 
tests' classpath running on the generated test and not on target/classses.
(a maven -X shows me that target/classes are used while my It test are 
executed using the surfire conf in the verify phase)

Ideas someone ?

Thanks a lot.

ap

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


Re: Test built jar

Posted by Wayne Fay <wa...@gmail.com>.
> If it doesn't make sense, what can I do (other than : created a project
> having a dependency on the to-be-tested project...)

This sounds like the most sane and "standard" solution to the problem,
given what you've said above. Or you could try binding an execution of
m-jar-p to a phase earlier than package and before test, and then
monkey with the Surefire parameters to it tests the jar instead of
target/classes. But this sounds very non-standard and I'm not positive
it would even work.

Wayne

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


Re: Test built jar

Posted by andy petrella <ap...@telemis.com>.
ok :)

What I need is to be able to test the behavior of my code when the jar 
is attached to the classpath instead of the classes folder.
Because, I have a code that parse the content of the jar where it stands 
to find xml files or use getResourceAsStream to get the folder.

So the code checks if the context is jar or not, then execute the 
corresponding code. The code using getResourceAsStream is well tested 
but the other cannot because surefire adds the folder target/classes to 
the classpath rather than (in my case) the built jar.

Sorry if it wasn't clear, or still not clear.

If it doesn't make sense, what can I do (other than : created a project 
having a dependency on the to-be-tested project...)

Thanks

ap


Wayne Fay a écrit :
>> ping ^^
>>     
>
> I think no one replied because your message does not make any sense
> (to me at least). Can you try re-writing the email and focus on what
> you have, what you need, and how you think Maven can help get you from
> A to B? Also mention what you've tried and why that didn't work or was
> insufficient.
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>   


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


Re: Test built jar

Posted by Wayne Fay <wa...@gmail.com>.
> ping ^^

I think no one replied because your message does not make any sense
(to me at least). Can you try re-writing the email and focus on what
you have, what you need, and how you think Maven can help get you from
A to B? Also mention what you've tried and why that didn't work or was
insufficient.

Wayne

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


Re: Test built jar

Posted by andy petrella <ap...@telemis.com>.
ping ^^

andy petrella a écrit :
> Hi All,
>
> I trying to have some IT tests (or look-like) on my jar file only. I 
> was thinking that the phase verify will give me that chance but not.
>
> Here is my problem.
>
> I have a jar where some directory has to be parsed on a file pattern 
> => I use the JarFile class, then parse it to retrieve what I need 
> (some XML files).
>
> This code must be tested (a lot !) but I can figure out how to have my 
> tests' classpath running on the generated test and not on 
> target/classses.
> (a maven -X shows me that target/classes are used while my It test are 
> executed using the surfire conf in the verify phase)
>
> Ideas someone ?
>
> Thanks a lot.
>
> ap
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


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