Versions are required when it shouldn't with multi-modules projects and war
dependencies
----------------------------------------------------------------------------------------
Key: MNG-2241
URL: http://jira.codehaus.org/browse/MNG-2241
Project: Maven 2
Type: Bug
Versions: 2.0.4
Environment: Maven 2.0.4, Java 5, Windows XP
Reporter: Celso Gomes Barreto Junior
In a multi-project with a parent pom which should enforces modules's versions
in dependencyManagement element, when I use a war dependnecy it starts to
require the version declaration in child pom's dependencies. When I use jar
dependencies, it works fine.
Project structure:
parent project
|_ web (war)
|_ commons (jar)
|_ webcommons (war)
--------------------------------------------------
parent project pom:
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<name>Procdev - ReferĂȘncia</name>
<groupId>globo</groupId>
<artifactId>procdevref</artifactId>
<packaging>pom</packaging>
<version>0.0.1</version>
<description>no</description>
<modules>
<module>web</module>
<module>commons</module>
<module>webcommons</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>globo</groupId>
<artifactId>procdevref-web</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>globo</groupId>
<artifactId>procdevref-commons</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>globo</groupId>
<artifactId>procdevref-webcommons</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
--------------------------------------------------
web project pom:
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>globo</groupId>
<artifactId>procdevref</artifactId>
<version>0.0.1</version>
</parent>
<name>Procdev Web</name>
<artifactId>procdevref-web</artifactId>
<packaging>war</packaging>
<version>0.0.1</version>
<description>no</description>
<dependencies>
<dependency>
<groupId>globo</groupId>
<artifactId>procdevref-webcommons</artifactId>
<type>war</type>
</dependency>
<dependency>
<groupId>globo</groupId>
<artifactId>procdevref-commons</artifactId>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>[1.1.2,]</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>[1.1.2,]</version>
</dependency>
</dependencies>
</project>
--------------------------------------------------
webcommons project pom:
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>globo</groupId>
<artifactId>procdevref</artifactId>
<version>0.0.1</version>
</parent>
<name>Procdev Web Commons</name>
<artifactId>procdevref-webcommons</artifactId>
<packaging>war</packaging>
<version>0.0.1</version>
<description>no</description>
</project>
--------------------------------------------------
commons project pom:
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>globo</groupId>
<artifactId>procdevref</artifactId>
<version>0.0.1</version>
</parent>
<name>Procdev Commons</name>
<artifactId>procdevref-commons</artifactId>
<packaging>jar</packaging>
<version>0.0.1</version>
<description>no</description>
</project>
When i Run it with "mvn -X clean install" I get:
+ Error stacktraces are turned on.
Maven version: 2.0.4
[DEBUG] Building Maven user-level plugin registry from: 'C:\Documents and Settin
gs\celso.cs\.m2\plugin-registry.xml'
[DEBUG] Building Maven global-level plugin registry from: 'C:\java\maven-2.0.4\b
in\..\conf\plugin-registry.xml'
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: globo:procdevref-web
POM Location: C:\Projetos\ProcdevReferencia\web\pom.xml
Validation Messages:
[0] 'dependencies.dependency.version' is missing for globo:procdevref-webco
mmons
Reason: Failed to validate POM
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira