1

I have a maven project build on java 7 say A. I have a another external maven project build on java 8 say B.

Is it possible to add dependency of project B in project A?

Arun
  • 158
  • 3
  • 17

2 Answers2

3

It's is not possible as the classes in project B (when compiled with Java 8) will have a different class format. The result will be some type of class format error like here.

If project B is compiled with target 1.7 and uses no API from Java 8 then it is possible that it will work.

The safest thing is to assume that you have to use Java 8 when using project B.

Community
  • 1
  • 1
Uwe Plonus
  • 9,803
  • 4
  • 41
  • 48
  • *@Uwe Plonus* thanks for quick response.I am able to compile project A with dependency of projet B, but i am getting error of **java.lang.UnsupportedClassVersionError** when running unit tests. – Arun Apr 15 '15 at 08:28
0

Usually not, but it depends on what APIs project B uses.

chrylis -cautiouslyoptimistic-
  • 75,269
  • 21
  • 115
  • 152