If you question is - can I use a WAR file as a dependency and get the classes 
inside the WAR file added to the classpath, the answer is no. This has nothing 
to do with Maven - it's Java.

-----Original Message-----
From: Chris Bredesen [mailto:[email protected]] 
Sent: Wednesday, October 07, 2009 10:50 AM
To: [email protected]
Subject: Re: Unit test project depending on WAR project code

I got your meaning and I will investigate that.  I generally try to KISS and 
adding a module to create a jar to go in a war kinda violates that. 
  But if it's the only way out of this, I'll try it.

Oddly, when I remove the <packaging>war</packaging> from the unit test 
project's dependency list, it works in m2eclipse (which AFIAK is based on M3).  
In that state, maven 2.0.10 barfs completely and can't even find the dependency 
which is farther from success than what I've got.

I'd really like to see if this is meant to work in Maven or if I'm just 
DoingItWrong.

Thanks for your input Roland, must appreciated!!!

-CB

On 10/07/2009 10:43 AM, Roland Asmann wrote:
> ThatÅ› not the way I meant it... Sorry if it looked that way!
>
> When I have a WAR-project, I normally create 2 modules: 1 with the 
> java-code
> (package: JAR) and 1 with the other WAR-stuff (JSP, CSS, etc - package: WAR).
>
> That way, I can use the code inside the JAR as a normal dependency in 
> any and all tests I have.
>
> Hope this cleared it up a bit. :-)
>
>
> On Wednesday 07 October 2009 16:41, Chris Bredesen wrote:
>> Why stop there?  I'll just not write ANY code.  Stress-free life! :) 
>> :)
>>
>> On 10/07/2009 10:13 AM, Roland Asmann wrote:
>>> Personally, I don't put ANY code in the WAR. That will definitely 
>>> solve your problem! :-)
>>>
>>> On Wednesday 07 October 2009 16:03, Chris Bredesen wrote:
>>>> All,
>>>>
>>>> I have split my unit tests out into a separate project which will 
>>>> eventually become a module (not there yet).  I've got it mostly 
>>>> sorted but I'm getting compile errors on classes that are part of 
>>>> the main project which uses war packaging.
>>>>
>>>> Maven doesn't seem to add the WAR's code into the test module's 
>>>> test classpath correctly.  Is this a known issue?  Any idea how to 
>>>> get around it?  Maven is definitely finding the artifact in my 
>>>> repository; it's just not contributing the WAR's code (I think).
>>>>
>>>> Any help is appreciated.
>>>>
>>>> -Chris
>>>>
>>>> -------------------------------------------------------------------
>>>> -- To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to