Re: Parent Dependencies
I see I've misinterpreted the concept from the maven guide. Thanks for clearing up my misunderstanding! :) Best regards Kiren On Fri, Sep 30, 2011 at 1:53 PM, Guillaume Polet wrote: > Hi, > > So I have briefly read your pom.xml and it seems that you have put the > dependency for spring in the dependencyMgmt element and not in the > dependencies element. So let me straight things out here: > * dependencyMgmt are used to declare version number, configuration, scope, > etc... but it does not mean that you depend on them, you just inform Maven > of the default values to use, if they are not defined in the dependencies > element. > * dependencies are used to declare on which artifacts your project(s) > depend. If you do not define version, scope, etc..., Maven will try to pick > them up from the dependencyMgmt. > > A best practice is to define in your super pom, the version of all your > dependencies of all your project in the dependencyMgmt and then simply > "instantiate" those dependency in each child project. This allows you to > centralize all the versions of all jars used in all projects. > > So in your super pom you define: > > > x.y.z > azerty > 1.2.3 > > ... > > > Then in your child pom you can simply put: > > > x.y.z > azerty > > ... > > without the version number, and Maven will automatically find that you want > version 1.2.3. Yet, you can still "override" this default value by setting > the version number in the child pom. > > In the dependency > > Le 30/09/2011 11:02, Kiren Pillay a écrit : >> >> Hi >> >> I think our project is misconfigured. From reading the docs again, the >> common dependencies go to within the dependencyManagent tag (we where >> using the dependencies before). >> >> I've fixed this but still see that the dependencies declared in the >> super pom aren't being picked up by the children. >> >> For instance the springframeork annotation package isn't being picked >> up even though its in the super pom. >> >> [ERROR] >> /home/kiren/Documents/workspace-subsnp/pams-main/core/advantage/src/main/java/za/co/vodacom/pams/core/in/dao/INSubscriberProfileDaoImpl.java:[4,51] >> package org.springframework.beans.factory.annotation does not exist >> >> Child: >> >> >> >> http://maven.apache.org/POM/4.0.0"; >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 >> http://maven.apache.org/xsd/maven-4.0.0.xsd";> >> >> 4.0.0 >> >> >> za.co.vodacom.pams >> pams-core >> 1.2.1-DEV-SNAPSHOT >> >> >> za.co.vodacom.pams >> pams-advantage >> 1.2.1-DEV-SNAPSHOT >> PAMS Core - IN DAO >> jar >> >> >> >> >> >> za.co.vodacom.advantage >> advantage-corba-interface >> >> >> >> za.co.vodacom.fap >> fap-core >> ${fcaps.version} >> jar >> compile >> >> >> >> >> >> >> >> >> maven-compiler-plugin >> >> ${java.source.version} >> ${java.target.version} >> true >> >> >> >> maven-surefire-plugin >> >> never >> >> >> >> >> >> >> >> >> >> >> Parent: >> >> >> >> http://maven.apache.org/POM/4.0.0"; >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 >> http://maven.apache.org/xsd/maven-4.0.0.xsd";> >> >> 4.0.0 >> >> >> za.co.vodacom.pams >> pams-main >> 1.2.1-DEV-SNAPSHOT >> >> >> za.co.vodacom.pams >> pams-core >> PAMS Core >> pom >> 1.2.1-DEV-SNAPSHOT >> >> >> >> common >> pams-schema >> advantage >> ppfe-connectors >> ppfe_dao >> pams-rms-dao >> pams-pams-dao >> >> pams-cur-dao >> >> >> >> >> Super ("Grandparent") >> >> >> >> http://maven.apache.org/POM/4.0.0"; >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 >> http://maven.apache.org/xsd/maven-4.0.0.xsd";> >> >> 4.0.0 >> >> za.co.vodacom.pams >> pams-main >> 1.2.1-DEV-SNAPSHOT >> pom >> PAMS - Main >> >> >> core >> business_services >> >> >> >> 1.2.1-DEV-SNAPSHOT >> 1.1.0 >> 3.0.5.RELEASE >> 1.6.1 >> >> 1.2.16 >> 4.8.1 >> 1.6 >> 1.6 >> >> 2.4.2 >> 3.1 >> 1.1.1 >> 2.5.0 >> 8.9.26 >> 3.3.2.GA >> 1.6.1 >> slf4j-log4j12 >> 1.2.2 >> 5.64 >> >> >> >> >> >> >> >> maven-jar-plugin >>
Re: Parent Dependencies
Hi, So I have briefly read your pom.xml and it seems that you have put the dependency for spring in the dependencyMgmt element and not in the dependencies element. So let me straight things out here: * dependencyMgmt are used to declare version number, configuration, scope, etc... but it does not mean that you depend on them, you just inform Maven of the default values to use, if they are not defined in the dependencies element. * dependencies are used to declare on which artifacts your project(s) depend. If you do not define version, scope, etc..., Maven will try to pick them up from the dependencyMgmt. A best practice is to define in your super pom, the version of all your dependencies of all your project in the dependencyMgmt and then simply "instantiate" those dependency in each child project. This allows you to centralize all the versions of all jars used in all projects. So in your super pom you define: x.y.z azerty 1.2.3 ... Then in your child pom you can simply put: x.y.z azerty ... without the version number, and Maven will automatically find that you want version 1.2.3. Yet, you can still "override" this default value by setting the version number in the child pom. In the dependency Le 30/09/2011 11:02, Kiren Pillay a écrit : Hi I think our project is misconfigured. From reading the docs again, the common dependencies go to within the dependencyManagent tag (we where using the dependencies before). I've fixed this but still see that the dependencies declared in the super pom aren't being picked up by the children. For instance the springframeork annotation package isn't being picked up even though its in the super pom. [ERROR] /home/kiren/Documents/workspace-subsnp/pams-main/core/advantage/src/main/java/za/co/vodacom/pams/core/in/dao/INSubscriberProfileDaoImpl.java:[4,51] package org.springframework.beans.factory.annotation does not exist Child: http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> 4.0.0 za.co.vodacom.pams pams-core 1.2.1-DEV-SNAPSHOT za.co.vodacom.pams pams-advantage 1.2.1-DEV-SNAPSHOT PAMS Core - IN DAO jar za.co.vodacom.advantage advantage-corba-interface za.co.vodacom.fap fap-core ${fcaps.version} jar compile maven-compiler-plugin ${java.source.version} ${java.target.version} true maven-surefire-plugin never Parent: http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> 4.0.0 za.co.vodacom.pams pams-main 1.2.1-DEV-SNAPSHOT za.co.vodacom.pams pams-core PAMS Core pom 1.2.1-DEV-SNAPSHOT common pams-schema advantage ppfe-connectors ppfe_dao pams-rms-dao pams-pams-dao pams-cur-dao Super ("Grandparent") http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> 4.0.0 za.co.vodacom.pams pams-main 1.2.1-DEV-SNAPSHOT pom PAMS - Main core business_services 1.2.1-DEV-SNAPSHOT 1.1.0 3.0.5.RELEASE 1.6.1 1.2.16 4.8.1 1.6 1.6 2.4.2 3.1 1.1.1 2.5.0 8.9.26 3.3.2.GA 1.6.1 slf4j-log4j12 1.2.2 5.64 maven-jar-plugin 2.3.1 test-jar test-compile org.springframework spring-test ${spring.version} za.co.vodacom.pams pams-core-xsd-server ${pams.version} jar com
Re: Parent Dependencies
Hi I think our project is misconfigured. From reading the docs again, the common dependencies go to within the dependencyManagent tag (we where using the dependencies before). I've fixed this but still see that the dependencies declared in the super pom aren't being picked up by the children. For instance the springframeork annotation package isn't being picked up even though its in the super pom. [ERROR] /home/kiren/Documents/workspace-subsnp/pams-main/core/advantage/src/main/java/za/co/vodacom/pams/core/in/dao/INSubscriberProfileDaoImpl.java:[4,51] package org.springframework.beans.factory.annotation does not exist Child: http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> 4.0.0 za.co.vodacom.pams pams-core 1.2.1-DEV-SNAPSHOT za.co.vodacom.pams pams-advantage 1.2.1-DEV-SNAPSHOT PAMS Core - IN DAO jar za.co.vodacom.advantage advantage-corba-interface za.co.vodacom.fap fap-core ${fcaps.version} jar compile maven-compiler-plugin ${java.source.version} ${java.target.version} true maven-surefire-plugin never Parent: http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> 4.0.0 za.co.vodacom.pams pams-main 1.2.1-DEV-SNAPSHOT za.co.vodacom.pams pams-core PAMS Core pom 1.2.1-DEV-SNAPSHOT common pams-schema advantage ppfe-connectors ppfe_dao pams-rms-dao pams-pams-dao pams-cur-dao Super ("Grandparent") http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> 4.0.0 za.co.vodacom.pams pams-main 1.2.1-DEV-SNAPSHOT pom PAMS - Main core business_services 1.2.1-DEV-SNAPSHOT 1.1.0 3.0.5.RELEASE 1.6.1 1.2.16 4.8.1 1.6 1.6 2.4.2 3.1 1.1.1 2.5.0 8.9.26 3.3.2.GA 1.6.1 slf4j-log4j12 1.2.2 5.64 maven-jar-plugin 2.3.1 test-jar test-compile org.springframework spring-test ${spring.version} za.co.vodacom.pams pams-core-xsd-server ${pams.version} jar compile org.slf4j slf4j-api ${slf4j.version} jar org.slf4j jcl-over-slf4j ${slf4j.version} jar org.slf4j ${slf4j.log4j.version} ${slf4j.version} jar com.tandem.t4jdbc t4sqlmx ${tandem.jdbc.version} jar commons-logging commons-logging org.hibernate hibernate-core ${hibernate.version} jar commons-logging commons-logging org.hibernate hibernate-entitymanager ${hibernate.version} jar cglib cglib
Re: Parent Dependencies
Thanks. Will try it again. Regards On Sep 29, 2011 2:02 PM, "Guillaume Polet" wrote:
Re: Parent Dependencies
Sure, the inheritance is transitive. You can have as many levels as you want: If you have a hierarchy like this: * A o B + C All dependencies declared in A will also be available for B and C and all dependencies declared in B will also be available for C. Guillaume Le 29/09/2011 12:57, Kiren Pillay a écrit : Thanks for the explanation Guillame...this works as you've stated. However my question is, is the inheritance transitive, i.e, the child pom would inherit the dependencies of the "grandparent" pom? From what I'm seeing this is not the case. Regards On Thu, Sep 29, 2011 at 11:43 AM, Guillaume Polet wrote: I am not sure I understood you correctly but here is what I can tell: Let's say you have a Main project which contains two modules: dao and business: * Main o dao o business If in your Main pom.xml, you have defined the following: a.b.c Main 1.0 x.y.z azerty 1.0 If in your dao pom.xml, you have defined the following a.b.c Main 1.0 then yes, you should inherit the dependency provided in you Main pom.xml, ie, in my example: x.y.z azerty 1.0 Without any more information, it will be hard to help more I think. Cheers, Guillaume Le 29/09/2011 11:32, Kiren Pillay a écrit : Hi All We have a project with multi-level modules. Main core--dao +---business From what I've read, if I've defined the dependency in the Main module, I don't need to repeat the defintion the dao module. Is this correct, because it doesn't seem to work for me? Regards Kiren - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Parent Dependencies
Thanks for the explanation Guillame...this works as you've stated. However my question is, is the inheritance transitive, i.e, the child pom would inherit the dependencies of the "grandparent" pom? From what I'm seeing this is not the case. Regards On Thu, Sep 29, 2011 at 11:43 AM, Guillaume Polet wrote: > I am not sure I understood you correctly but here is what I can tell: > Let's say you have a Main project which contains two modules: dao and > business: > > * Main > o dao > o business > > If in your Main pom.xml, you have defined the following: > a.b.c > Main > 1.0 > > > > x.y.z > azerty > 1.0 > > > > If in your dao pom.xml, you have defined the following > > a.b.c > Main > 1.0 > > > then yes, you should inherit the dependency provided in you Main pom.xml, > ie, in my example: > x.y.z > azerty > 1.0 > > Without any more information, it will be hard to help more I think. > > Cheers, > Guillaume > Le 29/09/2011 11:32, Kiren Pillay a écrit : >> >> Hi All >> >> We have a project with multi-level modules. >> >> >> Main core--dao >> +---business >> >> From what I've read, if I've defined the dependency in the Main >> module, I don't need to repeat the defintion the dao module. Is this >> correct, because it doesn't seem to work for me? >> >> Regards >> Kiren >> >> - >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >> For additional commands, e-mail: users-h...@maven.apache.org >> > > - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Parent Dependencies
I am not sure I understood you correctly but here is what I can tell: Let's say you have a Main project which contains two modules: dao and business: * Main o dao o business If in your Main pom.xml, you have defined the following: a.b.c Main 1.0 x.y.z azerty 1.0 If in your dao pom.xml, you have defined the following a.b.c Main 1.0 then yes, you should inherit the dependency provided in you Main pom.xml, ie, in my example: x.y.z azerty 1.0 Without any more information, it will be hard to help more I think. Cheers, Guillaume Le 29/09/2011 11:32, Kiren Pillay a écrit : Hi All We have a project with multi-level modules. Main core--dao +---business From what I've read, if I've defined the dependency in the Main module, I don't need to repeat the defintion the dao module. Is this correct, because it doesn't seem to work for me? Regards Kiren - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org