Solved

How to Control Maven Dependency Order in Different Modules

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

Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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 how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

691 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