maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Abitfarago Cini <ciniabitfar...@gmail.com>
Subject Maven dependencies - best practice
Date Tue, 15 Jan 2013 17:16:22 GMT
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:

<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?

SK

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message