Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup Maven dependencies between test folders in two projects?

I have a project setup like this:

parent
     |_____project-a
     |_____project-b

I want classes in the test folder of project-b to resolve classes in the test folder of project-a.

Actually, I want to access both classes from the main folder and stuff from the test folder.

Is this possible?

Thanks

like image 645
marathon Avatar asked Feb 24 '12 05:02

marathon


1 Answers

You can build project A with the goal test-jar

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>test-jar</goal>
                    </goals>
                </execution>
            </executions>               
        </plugin>       

Then include it with type test-jar in project B:

    <dependency>
        <groupId>com.example</groupId>
        <artifactId>project-a</artifactId>
        <type>test-jar</type>
        <version>1.0-SNAPSHOT</version>
        <scope>test</scope>
    </dependency>
like image 105
artbristol Avatar answered Oct 26 '22 02:10

artbristol