provided-scoped dependencies aren't transitive. As a result, there's no
reason to put them in the "our-dependencies" pom.
Kedar Mhaswade wrote:
The Maven books at sonatype.org suggest that while employing Maven to do
multi module builds, it is better to carefully segregate your dependencies
in a separate module whose packaging type is pom and then depend on this
module with <type>pom</type>.
I followed that advice and now I have the following:
<dependency>
<groupId>mygroup</groupId>
<artifactId>our-dependencies</artifactId>
<version>${project.version}</version>
<type>pom</type>
</dependency>
declared in my web-app's pom.xml. The idea being all the dependencies there
are depended on by this web-app module. One of the dependencies declared at
this common place (our-dependencies) is the servlet-api which should be
declared a "provided" dependency:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
The trouble is that with this dependency, my web-app fails to compile since
it can't find the servlet-api classes and interfaces. The only work-around
is that in my web-app, the servlet-api dependency has to be re-declared.
Is this a bug or a feature? Alternatively, is the best practice in such
cases to explicitly declare "provided" dependencies where they are actually
needed rather than grouping them as "our-dependencies"?
Thank you, in advance.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]