You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Chris Bredesen <cb...@redhat.com> on 2009/10/07 16:03:33 UTC

Unit test project depending on WAR project code

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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Unit test project depending on WAR project code

Posted by Chris Bredesen <cb...@redhat.com>.
This makes sense.  Thanks Justin.

-Chris

On 10/07/2009 11:51 AM, Edelson, Justin wrote:
> 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:cbredesen@redhat.com]
> Sent: Wednesday, October 07, 2009 10:50 AM
> To: users@maven.apache.org
> 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: 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
>>
>
>
> ---------------------------------------------------------------------
> 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
>


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


RE: Unit test project depending on WAR project code

Posted by "Edelson, Justin" <Ju...@mtvstaff.com>.
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:cbredesen@redhat.com] 
Sent: Wednesday, October 07, 2009 10:50 AM
To: users@maven.apache.org
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: 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
>


---------------------------------------------------------------------
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: Unit test project depending on WAR project code

Posted by Chris Bredesen <cb...@redhat.com>.
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: 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
>


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


Re: Unit test project depending on WAR project code

Posted by Roland Asmann <Ro...@cfc.at>.
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: 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

-- 
Roland Asmann

CFC Informationssysteme Entwicklungsgesellschaft m.b.H
Bäckerstrasse 1/2/7
A-1010 Wien
FN 266155f, Handelsgericht Wien

Tel.: +43/1/513 88 77 - 27
Fax.: +43/1/513 88 62
Email: Roland.Asmann@cfc.at
Web: www.cfc.at

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


Re: Unit test project depending on WAR project code

Posted by Chris Bredesen <cb...@redhat.com>.
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: 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: Unit test project depending on WAR project code

Posted by Roland Asmann <Ro...@cfc.at>.
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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org

-- 
Roland Asmann

CFC Informationssysteme Entwicklungsgesellschaft m.b.H
Bäckerstrasse 1/2/7
A-1010 Wien
FN 266155f, Handelsgericht Wien

Tel.: +43/1/513 88 77 - 27
Fax.: +43/1/513 88 62
Email: Roland.Asmann@cfc.at
Web: www.cfc.at

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