Solved

How to Control Maven Dependency Order in Different Modules

Posted on 2011-09-09
5
306 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
  • 3
  • 2
5 Comments
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 500 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

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…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

785 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