Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] WAR dependency not working in m2e

Attached classes are not supported in m2e-wtp. However, you can workaround the issue by using the following trick :
In your test project pom.xml, pick the proper classifier depending on whether you're inside m2e or not :



On your test sample, tests pass in boss CLI and Eclipse.


Fred Bricon
On Wed, Nov 16, 2011 at 5:15 PM, Miguel Almeida <migueldealmeida@xxxxxxxxx> wrote:
On a follow-up, I attach a simple test case with a parent and 2 modules.
- module1 is WAR
- module2 is jar

If you run "mvn test" in the parent, it works.

If you import it into eclipse and try to run module2's CopiedSpringPropertiesTest: class path resource [originalApplicationContext.xml] cannot be opened because it does not exist
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(

originalApplicationContext.xml is in module1.
I installed m2e-wtp in my Eclipse, but the configuration in the zip file doesn't work.

Perhaps this is easier to understand what the problem might be.


Miguel Almeida

On Wed, Nov 16, 2011 at 2:43 PM, Miguel Almeida <migueldealmeida@xxxxxxxxx> wrote:
Dear all,

I have a following project structure configured in Eclipse Indigo:

----------webApp (type war)

My acceptance depends on webApp, so I added the dependency:


When TYPE=WAR my junit tests fail in Eclipse. If TYPE=jar they work correctly, but my CI server (and maven in CLI, I presume) will fail saying they can't find webApp.jar.

I read something about this in, so I decided to give it a go:
- My maven-war-plugin snippet at webApp became [1]
- I added <classifier>classes</classifier> to the dependency in acceptance.

While both my CI server and "mvn test" work correctly, running an acceptance test from Eclipse fails as before, with a java.lang.ExceptionInInitializerError tracked down to " class path resource [spring-sessionFactory.xml] cannot be opened because it does not exist". This file is in webApp/src/main/resources.

Could you tell me what I am doing wrong? Do you know what is causing this and what the correct configuration should be?


Miguel Almeida


m2e-users mailing list

"Have you tried turning it off and on again" - The IT Crowd

Back to the top