In my maven project I am using a dependency of type test-jar which m2e does not like and gives the following warning.
"Dependency to project foo with type test-jar is not fully supported. Classpath and/or deployment issues might arise. Try Maven->Disable Workspace"
Why does this problem arise and why would disabling workspace resolution fix it?
The problem with test-jar is in Eclipse see Bug 365419 - Classpath for Integration Test
I have tried making this warning go away with the hack below, however it has a side effect of making it impossible to run tests from eclipse because of the class-path for the tests in eclipse when running code does not get set properly. I am posting here in hopes that some one can improve this hack and make it work.
Create a profile in the pom file is turned off when in eclipse but automatically turns on when running maven outside eclipse.
<profiles>
<profile>
<id>test-jars</id>
<activation>
<property>
<name>!m2e.version</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>foo</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.example</groupId>
<artifactId>bar</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
Inside eclipse the m2e.version property is defined so the test-jar dependencies are ignored by m2e and no warning is generated. However, when running maven on the command line the profile activates because there is no m2e.version property and so the warning goes away.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With