Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse - How to add a project as a Maven dependency to another, instead of adding as a jar?

I have two Maven projects. One should be a dependency to another. Both have pom.xml files. When I search repository, it sees the local project and automatically added.

The pom.xml entry when I add it:

<dependencies>
    <dependency> // for another dependency, an external jar
        <groupId>..</groupId>
        <artifactId>..</artifactId>
        <version>...</version>
    </dependency>
    <dependency> // the one for other project which I want to add as dependency
        <groupId>..</groupId>
        <artifactId>..</artifactId>
        <version>..</version>
    </dependency>
</dependencies>

But the references to that project can not see the classes. Is there some specific way to do that, instead of adding from repository?

like image 653
ahmetozkok Avatar asked Oct 31 '22 08:10

ahmetozkok


1 Answers

You set the type of dependency using the <type> tag inside <dependency> tag.

<dependency> 
    <groupId>..</groupId>
    <artifactId>..</artifactId>
    <version>...</version>
    <type>jar OR war OR ejb-client OR test-jar</type>
</dependency>

The default value for type is jar

like image 121
Mithun Avatar answered Nov 13 '22 17:11

Mithun