[
http://jira.codehaus.org/browse/MNG-2241?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_99681
]
Kenney Westerhof commented on MNG-2241:
---------------------------------------
Specifying <type> in the dependencies in depMgt for deps that aren't
<packaging>jar should solve this.
However this needs to be fixed. A more strict separation between packaging,
types, and classifiers should be enforced.
The default of <type>jar</type> in a dependency is bogus - it needs to be the
same as the <packaging> from the pom for that artifact/dependency.
Specifing, for instance, a test-jar dependency, you can say
<type>test-jar</type>. Since this is not a derived artifact, classifiers don't
apply here.
It's an alternative packaging, so <type>test-jar</type> is correct. Classifiers
shouldn't apply here.
The same goes for attached assemblies.
Are Javadoc and source jars considered derived or alternative? Since the source
_could_ theoretically be derived from the main artifact, it could be a
classifier,
though you'd miss the javadoc, so I think these are alternatives, and a <type>
is wise here.
For war and ear artifacts, the packaging _is_ the main type; it's not an
attachment, either derived or alternative, so <type> shouldn't be needed
in dependencies or dependencyManagement.
Also, i've never seen multiple classifiers for one type, where the type is not
the main type.
Anyway, since this (<type>jar</type> being the default for dependencies) is
documented, this should be a closed-won't fix, though since I disagree with
the spec/documentation I'll leave this open.
> 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
> Issue Type: Bug
> Components: Dependencies
> Affects Versions: 2.0.4
> Environment: Maven 2.0.4, Java 5, Windows XP
> Reporter: Celso Gomes Barreto Junior
> Fix For: 2.1.x
>
>
> 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