Maven - command line to update dependency by groupId - maven

I would like to update dependencies just of the "groupA". How can I do this using command line?
<dependency>
<groupId>group-A</groupId>
<artifactId>artifact-1</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>group-A</groupId>
<artifactId>artifact-2</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>group-B</groupId>
<artifactId>artifact-1</artifactId>
<version>1.0.0</version>
</dependency>

The versions plugin has a goal "use-latest-versions" that seems to do what you need.
Assume you have something like:
<dependencies>
<dependency>
<groupId>group-B</groupId>
<artifactId>artifact-1</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.9</version>
</dependency>
</dependencies>
Then running: mvn versions:use-latest-versions -D"includes=org.apache.commons:*:*:*:*"
would update those two dependencies in that group:
[INFO] --- versions-maven-plugin:2.7:use-latest-versions (default-cli) # artifact-id ---
[INFO] Major version changes allowed
[INFO] Updated org.apache.commons:commons-lang3:jar:3.1 to version 3.9
[INFO] artifact org.apache.commons:commons-compress: checking for updates from central
[INFO] Updated org.apache.commons:commons-compress:jar:1.9 to version 1.18
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
Assuming you just want the latest version that can be found in a repository.
The versions plugin has some other things to offer as well. For dependency work the dependency plugin is also often handy.

Related

Transitive dependencies brought by provided scope and compile scope are computed as compile scope

We face an issue when a same artifact-X is transitively brought by a dependency-1 with provided scope, and another dependency-2 with default (compile) scope.
This artifact-X will be computed as compile scope, while we expect it to be explicitly provided by dependency-1.
For example, dependency-1 pom contains:
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.1</version>
</dependency>
</dependencies>
dependency-2 pom contains:
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.8</version>
</dependency>
</dependencies>
Assembly project pom contains:
<dependencies>
<!-- do not include dependencies already provided by module-1 at runtime -->
<dependency>
<groupId>com.company</groupId>
<artifactId>module-1</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<!-- get dependencies required by module-2 runtime -->
<dependency>
<groupId>com.company</groupId>
<artifactId>module-2</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
But a mvn dependency:tree on assembly project will output:
[INFO] --- maven-dependency-plugin:3.1.0:tree (show-app-dependencies) # module-3 ---
[INFO] com.company:module-3:pom:1.0
[INFO] +- com.company:module-1:jar:1.0:provided
[INFO] | +- org.apache.commons:commons-lang3:jar:3.7:compile
[INFO] | \- org.apache.commons:commons-collections4:jar:4.1:provided
[INFO] \- com.company:module-2:jar:1.0:compile
And we can see the artifact commons-lang3:jar:3.7 which come from dependency-1 is now at compile scope. Note that we don't use any <dependencyManagement> here.
This is very confusing, and leads to duplicate libraries in runtime classpath when dependency-1 is effectively provided in classpath of dependency-2 runtime (for example by an application server).
Moreover, based on Maven documentation about dependency mediation/scope, the transitive dependencies that are provided should be always ommited.
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope
It seems to be a bug, that maven-3.6 does not handle, which is a shame !
However, as our goal is simply to package ONLY the libraries defined as compile/runtime (and ignore all the provided ones, and their transitives), how to achieve this using dependency management, or if impossible, using maven-assembly-plugin ??

[Cucumber][JVM][Maven]Tests dosen't run from command line through maven

I am running tests using java, cucumber with Maven.
I am using Eclipse IDE. Also the pom.xml has cucumber dependencies.
I am running tests in two ways.
From Eclipse IDE: I run tests as Junit tests and the test results are successful.
2: From command promt: My test failed and below is the result.
Here is the Pom.xml:
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>CCIRA_Test_Auto</groupId>
<artifactId>CCIRA_Test_Auto</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<name>CCIRA_Test_Auto</name>
<properties>
<cucumber.version>1.2.0</cucumber.version>
<picocontainer.version>2.15</picocontainer.version>
</properties>
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>phantomjsdriver</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.44.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.11-beta3</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.8.0</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
My Runner Test:
package ccira.helpers;
import org.junit.runner.RunWith;
import org.testng.annotations.Test;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
#RunWith(Cucumber.class)
#CucumberOptions(
features = "C:/Users/rah/Documents/workspace/CCIRA_auto/src/ressouces/features",
tags = {"#Personne"},
glue={"ccira.stepDefinitions"},
plugin ={
"pretty",
"html:results/cucumber",
"json:results/cucumber.json",
"junit:results/cucumber.xml",
}
)
public class RunnerTest {
}
My output console :
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building CCIRA_Test_Auto 0.0.1
[INFO] ------------------------------------------------------------------------
[WARNING] The artifact xml-apis:xml-apis:jar:2.0.2 has been relocated to xml-apis:xml-apis:jar:1.0.b2
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # CCIRA_Test_Auto ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\rah\Documents\workspace\CCIRA_Test_Auto\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # CCIRA_Test_Auto ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # CCIRA_Test_Auto ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\rah\Documents\workspace\CCIRA_Test_Auto\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # CCIRA_Test_Auto ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # CCIRA_Test_Auto ---
[INFO] Surefire report directory: C:\Users\rah\Documents\workspace\CCIRA_Test_Auto\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.051s
[INFO] Finished at: Mon Dec 05 09:30:10 GMT 2016
[INFO] Final Memory: 7M/62M
[INFO] ------------------------------------------------------------------------
The dependency
org.slf4j.impl.StaticLoggerBinder
is not defined in your pom.xml file. However it is defined on your build path in your Eclipse project. Placing one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem.
I would add a dependency in your pom.xml, perhaps something like this:
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.21</version>
</dependency>
EDIT
A less good but viable alternative is to utilize the Surefire plugin's additionalClasspathElements element "to add custom resources/JARs to your classpath. This will be treated as an absolute file system path, so you may want use ${basedir} or another property combined with a relative path. Note that additional classpath elements are added to the end of the classpath, so you cannot use these to override project dependencies or resources."
I said less good because it is better to track as dependencies in your pom.xml where if you update one dependency to a later version you can see the other dependencies that also have to be updated. You might overlook jars specified down in the surefire plugin.
Try to run using the below command from command prompt
mvn clean test -Dcucumber.options="src/resources/features --tags ##Personne"

Maven dependencyManagement version ignored in transitive dependencies

Maven is transitively pulling in version 16 of guava, even though I have a <dependencyManagement> section which specifies version 18.
The quick summary:
gwizard-example depends on gwizard-config
gwizard-config has a parent pom, gwizard-parent
gwizard-parent has <dependencyManagement> which specifies version 18 of guava
Thankfully this is an opensource project, so you can see the poms directly: gwizard-parent, gwizard-config, gwizard-example. However, here's the important bit in gwizard-parent:
<properties>
<guava.version>18.0</guava.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
...and the no-frills dependency declared in gwizard-example:
<properties>
<gwizard.version>0.5</gwizard.version>
</properties>
<dependencies>
<dependency>
<groupId>org.gwizard</groupId>
<artifactId>gwizard-config</artifactId>
<version>${gwizard.version}</version>
</dependency>
</dependencies>
The dependency tree for gwizard-config shows guava 18 correctly:
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # gwizard-config ---
[INFO] org.gwizard:gwizard-config:jar:0.5
[INFO] +- com.google.inject:guice:jar:4.0-beta5:compile
[INFO] | \- com.google.guava:guava:jar:18.0:compile
However, the dependency tree for gwizard-example shows guava 16 (which causes problems):
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # gwizard-example ---
[INFO] org.gwizard:gwizard-example:jar:1.0-SNAPSHOT
[INFO] +- org.gwizard:gwizard-config:jar:0.5:compile
[INFO] | +- com.google.inject:guice:jar:4.0-beta5:compile
[INFO] | | \- com.google.guava:guava:jar:16.0.1:compile
This is using Maven v3.2.5. I am baffled. Help?
Possibly related: dependencyManagement in parent ignored
UPDATE: The poms linked on github are changing; adding a dependency to gwizard-services (which directly declares a guava dep) in gwizard-example "fixed" the problem. There's still some sort of bad underlying behavior here.
UPDATE: Created this JIRA issue
There is a simple thing. A dependencyManagement does not declare a dependency which is really used it's only defining versions etc. which can be used.
If you define something like this it will not result in a change.
<properties>
<guava.version>18.0</guava.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
If you really like to overwrite the version which is used in you tree you need to define a real dependency:
So based on the above definition you need to add the following as well:
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
</dependencies>
If you have added this please check afterwards via mvn dependency:tree.
Maven doesn't resolve the version transitive dependency issue in this case.
This issue can be used by using maven bom concept.
Check the maven documentation for bom in the below link
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management
Here is another blog which explains usage of bom's
http://howtodoinjava.com/maven/maven-bom-bill-of-materials-dependency/
In your case to solve this issue, you need to add the below dependency in the dependencyManagement section of the project gwizard-example.
<dependency>
<groupId>org.gwizard</groupId>
<artifactId>gwizard-parent</artifactId>
<version>${gwizard.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>

Build failure while downloading Archiva Jars with maven

I would like to download Archiva Rest API jars with maven 3 so I can make some Rest API and I always have a build failure. Here is my POM :
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva</artifactId>
<version>1.4-M3</version>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-rest-api</artifactId>
<version>1.4-M3</version>
</dependency>
I always have this error :
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Remote Deployment 1.0
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/org/kohsuke/access-modifier-checker/maven-metadata.xml
Downloaded: http://repo.maven.apache.org/maven2/org/kohsuke/access-modifier-checker/maven-metadata.xml (335 B at 1.6 KB/
sec)
Downloading: http://repo.maven.apache.org/maven2/org/kohsuke/stapler/stapler/maven-metadata.xml
Downloaded: http://repo.maven.apache.org/maven2/org/kohsuke/stapler/stapler/maven-metadata.xml (333 B at 5.1 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/archiva/archiva/1.4-M3/archiva-1.4-M3.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.820s
[INFO] Finished at: Wed Nov 07 15:38:03 CET 2012
[INFO] Final Memory: 25M/310M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project remote-deployment-new: Could not resolve dependencies for project com.ebiznext
.plugins:remote-deployment-new:hpi:1.0: Could not find artifact org.apache.archiva:archiva:jar:1.4-M3 in central (http:/
/repo.maven.apache.org/maven2) -> [Help 1]
....
How can I resolve that ?
[EDIT] In fact, I am working on a Jenkins plugin where I want this plugin to download some jars in Archiva. For that, I will do some Rest services. This is why I need these dependencies. To make Rest call, on a archiva instances, we must add the archiva-rest-api dependency and a lot more. The thing is it does not download them (archiva-rest-api, jackson, apache cxf). Here is my POM :
<dependencies>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>1.9.9</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-xc</artifactId>
<version>1.9.9</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.9</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle-jaxrs</artifactId>
<version>2.6.3</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-rest-api</artifactId>
<version>1.4-M4</version>
</dependency> -->
</dependencies>
<!-- get every artifact through repo.jenkins-ci.org, which proxies all the artifacts that we need -->
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
Your error is including the first dependency - org.apache.archiva:archiva contains no JAR artifact and Maven is complaining when it can't find it (see the directory listing in Maven central).
Try removing this dependency and trying again.
Maybe have a look here some dependencies are detailed http://archiva.apache.org/docs/1.4-M3/adminguide/webservices/rest.html

How to figure out the jars that the dependencies in the maven's pom.xml depend on?

I am very interested in how I can find out what are the jars that the dependences in the maven's pom.xml depend on.
I am used to doing the adding of libraries (jars) myself in my web application project. I came across this need when I was trying to configure the spring 3.0 samples. I really dislike that everything has to go through maven with spring 3.0.x. At this point it seems that I cannot dig deeper in the maven's dependency maze and learning it looks like a must. But I would really appreciate if someone can tell me a way I can find out this info.
For example, for the following pom.xml, I would like to know what the dependency with artifactId spring-context depends on. (I can see that it depends on commons-logging, since the creator of the sample excludes it - wanted to use slf4j instead of commons-logging.). I would like to find out the rest of the dependences for the dependency with artifactId spring-context, and the same for the rest of the dependences! How can I do this?
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.samples</groupId>
<artifactId>mvc-ajax</artifactId>
<name>mvc-ajax</name>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<properties>
<org.springframework.version>3.0.5.RELEASE</org.springframework.version>
<org.slf4j.version>1.6.1</org.slf4j.version>
</properties>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework.version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${org.slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${org.slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${org.slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>runtime</scope>
</dependency>
<!-- JSR 303 with Hibernate Validator -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.1.0.Final</version>
</dependency>
<!-- Joda Time -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>1.6.2</version>
<scope>runtime</scope>
</dependency>
<!-- Jackson JSON Mapper -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.6.4</version>
</dependency>
<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<!-- For Hibernate Validator -->
<repository>
<id>org.jboss.repository.release</id>
<name>JBoss Maven Release Repository</name>
<url>https://repository.jboss.org/nexus/content/repositories/releases</url>
<snapshots><enabled>false</enabled></snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Kind Regards,
Despot
EDIT (some follow up on the answer given by Sean):
1) Download maven (I downloaded version 2.2.1) and follow the installation instructions given there.
2) Than open command prompt and go to the directory of the pom.xml
3) Do the "mvn dependency:tree" command as advised. (I tried using -DoutputFile="somePath" or -Dinclude=spring-context -> it wasn't writing in the file presented in the path and it was selecting all the dependancies instead of spring-context - no matter the general command will suffice). Wait for a while for the system to download all needed info and in the end you will get something like this:
[INFO] [dependency:tree {execution: default-cli}]
[INFO] org.springframework.samples:mvc-ajax:war:1.0.0-SNAPSHOT
[INFO] +- org.springframework:spring-context:jar:3.0.5.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:3.0.5.RELEASE:compile
[INFO] | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | +- org.springframework:spring-beans:jar:3.0.5.RELEASE:compile
[INFO] | +- org.springframework:spring-core:jar:3.0.5.RELEASE:compile
[INFO] | +- org.springframework:spring-expression:jar:3.0.5.RELEASE:compile
[INFO] | \- org.springframework:spring-asm:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.0.5.RELEASE:compile
[INFO] | +- org.springframework:spring-context-support:jar:3.0.5.RELEASE:
compile
[INFO] | \- org.springframework:spring-web:jar:3.0.5.RELEASE:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.6.1:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.6.1:runtime
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.1:runtime
[INFO] +- log4j:log4j:jar:1.2.16:runtime
[INFO] +- javax.validation:validation-api:jar:1.0.0.GA:compile
[INFO] +- org.hibernate:hibernate-validator:jar:4.1.0.Final:compile
[INFO] +- joda-time:joda-time:jar:1.6.2:runtime
[INFO] +- org.codehaus.jackson:jackson-mapper-asl:jar:1.6.4:compile
[INFO] | \- org.codehaus.jackson:jackson-core-asl:jar:1.6.4:compile
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- javax.servlet.jsp:jsp-api:jar:2.1:provided
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- junit:junit:jar:4.7:test
[INFO] \- org.springframework:spring-test:jar:3.0.5.RELEASE:test
[INFO] ---------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ---------------------------------------------------------------
[INFO] Total time: 1 minute 8 seconds
[INFO] Finished at: Tue Jan 04 16:53:45 CET 2011
[INFO] Final Memory: 12M/25M
[INFO] ---------------------------------------------------------------
You can download the jars using Jarvana (just type jarvana + the name of the jar) or you can use the svn checkout command.
The hibernate-validator:jar:4.1.0.Final in Jarvana returns an error (there is no 4.1.0 Final version -> only 4.0.2 Final
Also org.codehaus.jackson-mapper-asl 1.6.4 could not be found - only 1.6.2 (same goes to the jackson-core-asl). I am presuming that the same would happen if you used maven to build your project.
After I included all the needed jars, I started the server in debug mode and this happened:
TIME org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\somePath\mvc-ajax3.0\WEB-INF\lib\jsp-api-2.1.jar) - jar not loaded.
See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/jsp/JspPage.class
TIME org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\somePath\mvc-ajax3.0\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded.
See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
This means (I think) that those jars are found twice. Deleting them done the job for me. Seams like the pom.xml is not valid for this sample.
It took too much time for me to download the jars manually and to "fight" all the project configuration, so I guess is best to learn some Maven if you are trying to start with Spring 3.0.
Execute mvn dependency:tree and it will list all the project's dependencies.
Reference:
dependency:tree mojo
Resolving conflicts using the Dependency Tree
Filtering the Dependency Tree
You didn't mention what IDE you are using. If you are using Eclipse then install the M2Eclipse plugin for Maven. Once installed it has an excellent Maven pom.xml editor that can show you many things...including an interactive, recursive, dependency tree.
You can see some videos on this feature here:
http://m2eclipse.sonatype.org/overview-of-the-m2eclipse-pom-editor.html

Resources