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 :
<dependencies>
<dependency>
<groupId>org.example</groupId>
<artifactId>module1</artifactId>
<version>1.0.0-SNAPSHOT</version>
<classifier>${webClassifier}</classifier>
</dependency>
</dependencies>
<properties>
<webClassifier>classes</webClassifier>
</properties>
<profiles>
<profile>
<id>m2e</id>
<activation>
<property>
<name>m2e.version</name>
</property>
</activation>
<properties>
<webClassifier></webClassifier>
</properties>
</profile>
</profiles>
On your test sample, tests pass in boss CLI and Eclipse.
Regards,
Fred Bricon
On Wed, Nov 16, 2011 at 5:15 PM, Miguel Almeida
<[email protected]>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:
>
> java.io.FileNotFoundException: class path resource
> [originalApplicationContext.xml] cannot be opened because it does not exist
> at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)
>
> 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.
>
> Cheers,
>
> Miguel Almeida
>
>
> On Wed, Nov 16, 2011 at 2:43 PM, Miguel Almeida <[email protected]
> > wrote:
>
>> 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>
>>
>
>
> _______________________________________________
> m2e-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/m2e-users
>
>
--
"Have you tried turning it off and on again" - The IT Crowd
_______________________________________________
m2e-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/m2e-users