The outcome i get is that in the lib folder of war file , I get two jars commons-logging.jar and spring-core.jar . I saw the pom.xml of spring-core module and it has also the dependency of commons-collections but that jar is not imported and included in my war file as <optional>true</optional> has bee set in spring-core pom.xml .
Is there any way to include all the jars whether optional , provided , test etc while building war
MavenDocs wrote:If a user wants to use functionality related to an optional dependency, they will have to redeclare that optional dependency in their own project.
But that just I want to avoid it though I am not sure how. To give you more context our project currently is on spring2.2.5 version and we don't use maven . We need to upgrade now our version from spring2.2.5 to spring 3.0.5.RELEASE . I searched through the net to know the dependency jars which this spring version would depen upon and could not find that . Instead I got the following thread in spring forum which says that you should use maven to get the dependent jars.
Now , since we can't upgrade to maven framework right away , I though to get the dependency jars by referring spring artifact assuming that all the dependencies jars would also come with it . But the optional one is left out.
Following is the link I refer to refer the spring artifacts in my pom.xml
Oh, so you are not using Maven to build your project, you are just trying to gather all of the dependent JARs. There might be hope! Try using either the Maven Assembly Plugin or the Maven Dependency Plugin. Both of those will gather transitive dependencies, and they are both highly configurable, and perhaps one of them will do what you need.