Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dependency to project foo with type test-jar is not fully supported.

Tags:

eclipse

maven

m2e

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?

like image 232
ams Avatar asked Jan 30 '13 17:01

ams


2 Answers

The problem with test-jar is in Eclipse see Bug 365419 - Classpath for Integration Test

like image 109
khmarbaise Avatar answered Nov 09 '22 12:11

khmarbaise


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.

like image 44
ams Avatar answered Nov 09 '22 11:11

ams