kn_pavan
kn_pavan

Reputation: 1618

intellij multi module project adds module as dependency instead of it's jar

I have 2 maven projects A and B.
B has a maven compile time dependency on A's fat jar.

While importing B as a maven project, A gets added as Module dependency instead of target jar.

Is there a way to disable this?

B's pom.xml (dependency part)

<dependency> <groupId>com.xxx.yyy</groupId> <artifactId>A</artifactId> </dependency>

A's pom.xml (artifact details):

<groupId>com.xxx.yyy</groupId> <artifactId>A</artifactId> <version>trunk-SNAPSHOT</version>

A is packaged to give Fat jar and B is using version plugin to determine A's version.

Problem:

These two are modules in Intellij project. Whichever the way I import them, Project B's dependencies list shows project A as module dependency, instead of the SNAPSHOT(or particular version) of project A's jar.

Because of this, whenever I try to package/install on Project B, I am seeing ClassNotFound for some of the helper classes from A.

Compile log for Project B:

Error:(21, 40) java: cannot find symbol
symbol:   class ImmutableMap
location: package org.xxx.yyy.zzz

Error:(22, 40) java: cannot find symbol
symbol:   class ImmutableSet
location: package org.xxx.yyy.zzz

This same class file can be seen in A's SNAPSHOT jar.

Upvotes: 2

Views: 1795

Answers (2)

kn_pavan
kn_pavan

Reputation: 1618

Found the answer on a different post. https://stackoverflow.com/a/11545441/639107

SNAPSHOT dependencies are resolved via project source location

Upvotes: 0

drJava
drJava

Reputation: 797

<dependency>
 <groupId>com.xxx.yyy</groupId>
 <artifactId>A</artifactId>
 <version>trunk-SNAPSHOT<version>
</dependency>

Can you try so by adding version to the B´ pom.xml and then, mvn clean install

Upvotes: 0

Related Questions