Well, if the Dependency version changed with the target java Bytecode version, you could create a multirelease jar and manage the dependencies via profiles.
But that would seem not feasible to me. What's your use case? Or maybe you could refactor that class(es) into modules instead? Best regards, Ben On Tue, 9 Jun 2020, 13:51 Jagat Singh, <[email protected]> wrote: > Hi, > > I wanted to learn what is the pattern in maven when we have to change the > import at the top of class based on dependency version. > > Example in Java code > > If dependency version is 1.0 > Then import path > > import com.hello.Class > > If dependency version is 2.0 > Then import path > > import com.hello2.Class > > > Thanks in advance. >
