Skip to main content

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

Dear all,

I have a following project structure configured in Eclipse Indigo:

-parent:
----------acceptance
----------webApp (type war)

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

        <dependency>(...)
            <artifactId>webApp</artifactId>
            <scope>test</scope>
            <type>TYPE</type>
        </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 http://ykyuen.wordpress.com/2009/10/30/maven-dependency-on-jarwar-package/, 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 "java.io.FileNotFoundException: 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?

Cheers,

Miguel Almeida

[1]
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1.1</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                        <manifestEntries>
                            <Implementation-Build>${buildNumber}</Implementation-Build>
                        </manifestEntries>
                    </archive>
                    <webResources>
                        <resource>
                            <directory>${basedir}/src/main/webapp/WEB-INF</directory>
                            <filtering>true</filtering>
                            <targetPath>WEB-INF</targetPath>
                            <includes>
                                <include>**/config.xml</include>
                            </includes>
                        </resource>
                    </webResources>
                    <attachClasses>true</attachClasses>
                    <classesClassifier>classes</classesClassifier>
                </configuration>
            </plugin>

Back to the top