Solved

How to Control Maven Dependency Order in Different Modules

Posted on 2011-09-09
5
302 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Spring Controller - inheritance in request parameter 3 38
topping1 challenge 7 53
@SBGen Method 3 25
bitbucket vs gitbucket 3 35
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now