Hi,

> I am testing the Maven dependecies. In a parent-child project 
arhitecture I
> am using many frameworks
> (log4j, xdoclet, etc) and these are installed in may local repository 
and I
> am able to use them.
> 
> I created and installed a POM, called "x-deps", to manage the 
dependecies:

*snip*

> 
> <project xmlns="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";>
>   <modelVersion>4.0.0</modelVersion>
>   <groupId>sk</groupId>
>   <artifactId>x-deps</artifactId>
>   <version>0.0.1-SNAPSHOT</version>
>   <packaging>pom</packaging>
>   <dependencyManagement>
>       <dependencies>
>           <dependency>
>               <groupId>log4j</groupId>
>               <artifactId>log4j</artifactId>
>               <version>1.2.8</version>
>           </dependency>
>           <dependency>
>               <groupId>xdoclet</groupId>
>               <artifactId>xdoclet</artifactId>
>               <version>2.0.3</version>
>           </dependency>
>       </dependencies>
>   </dependencyManagement>
> </project>
> 
> In a parent POM, called "a", I set the dependecyManager for "x-deps":
> 
> <project xmlns="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";>
>   <modelVersion>4.0.0</modelVersion>
>   <groupId>sk</groupId>
>   <artifactId>a</artifactId>
>   <version>0.0.1-SNAPSHOT</version>
>   <packaging>pom</packaging>
>   <modules>
>       <module>../b</module>
>   </modules>
>   <dependencyManagement>
>       <dependencies>
>           <dependency>
>               <groupId>sk</groupId>
>               <artifactId>x-deps</artifactId>
>               <version>0.0.1-SNAPSHOT</version>
>               <type>pom</type>
>           </dependency>
>       </dependencies>
>   </dependencyManagement>
> </project>
> 
> In its child POM, called "b", I would like to add the dependency only 
for
> log4j:
> 
> <project xmlns="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";>
>   <modelVersion>4.0.0</modelVersion>
>   <artifactId>b</artifactId>
>   <parent>
>       <groupId>sk</groupId>
>       <artifactId>a</artifactId>
>       <version>0.0.1-SNAPSHOT</version>
>   </parent>
>   <dependencies>
>       <dependency>
>           <groupId>log4j</groupId>
>           <artifactId>log4j</artifactId>
>       </dependency>
>   </dependencies>
> </project>
> 
> When I want to validate my POM "a" I get this error:
> 
> error: 'dependencies.dependency.version' for log4j:logj:jar is missing
> 
> Can somebody help me?

Quite easy:
In the referenced parent sk:a:0.0.1-SNAPSHOT you only manage a dependency 
for sk:x-deps:0.0.1-SNAPSHOT (which isn't used in b, btw), but not for the 
real dependencies you're using in your project b...

To use them, move the dependency management section from x-deps to your 
project a. That should do the trick.


HTH

Thorsten

Reply via email to