?
Solved

How to Control Maven Dependency Order in Different Modules

Posted on 2011-09-09
5
Medium Priority
?
310 Views
Last Modified: 2012-06-27
I have a program where I have the same java method at two  different locations. I have a java class, e.g., public class foo located "jiatfw-core "or Module B, I also have this same class (foo) located in module "core" or Module C. I am running my main class from a module called "jiatfw-bl" or Module A.

My problem is that my Module A is using the code in Module C or "core" where the class was originally defined, but I want it to use the class located in Model B or "jiatfw-core" which overrides the methods used in the base core.

Below is a cutout of my POM file located in module A or "jiatfw-bl".

I believe that which ever dependency is defined first is used first. Identical to defining different classes in a java classPath statement.

Can someone suggest to me what I might be doing wrong. Attached is a graph showing the relationship between modules.

    <parent>
        <artifactId>jiatfw-parent</artifactId>
        <groupId>com.inc.jiatfw</groupId>
        <version>1-SNAPSHOT</version>
    </parent>

    <artifactId>jiatfw-bl</artifactId>
    <name>JIATFW BL</name>

    <dependencies>
        <dependency>
            <groupId>com.inc.jiatfw</groupId>
            <artifactId>jiatfw-core</artifactId>
            <version>1-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>com.inc.components.core</groupId>
            <artifactId>core</artifactId>
        </dependency>
dependency.PNG
0
Comment
Question by:Cedarville
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 2000 total points
ID: 36513517
And both classes foo have the same fully qqualifies name with packages, etc.
So you have two copies of the same package jiatfw-core and the same pacjkage in core ?
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36513539
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36513578
You probably have later version of maven than 2.0.9, as as you see from the above link, before
the ordr was not specified deterministicallly
0
 

Accepted Solution

by:
Cedarville earned 0 total points
ID: 36514178
First, to answer your question for_yan. Yes, everthing is the same as far as package name and class/method name. I think the method signatures are different.

I will check out the link you specified.


Thankyou,
Cedarville
0
 

Author Closing Comment

by:Cedarville
ID: 36553549
Answer did not help, but I appreciate the effort
0

Featured Post

TCP/IP Network Protocol Cheat Sheet

TCP/IP is a set of network protocols which is best known for connecting the machines that make up the Internet. The truth is that TCP/IP is one of the oldest network protocols and its survival is mainly based on its simplicity and universality.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question