Reputation:
I have created a Web Project using Maven in Eclipse. I need pentaho library jar for the project and this is my dependency
<dependency>
<groupId>pentaho-library</groupId>
<artifactId>libbase</artifactId>
<version>1.2.8</version>
<optional>true</optional>
</dependency>
When I run mvn:compile
or mvn eclipse:eclipse
, it is downloading the JAR file in maven_repo
local directory
I am using the following war plugin
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
</plugin>
The problem is, when i run mvn war:war
to create the war file, it is not copying the libbase-1.2.8.jar to the WEB-INF/lib folder. But it is copying all other JAR files. What is the problem?
Upvotes: 2
Views: 2136
Reputation: 9069
The Introduction to the Dependency Mechanism: Transitive Dependencies told us about the optional
as the following:-
Optional dependencies - If project Y depends on project Z, the owner of project Y can mark project Z as an
optional dependency
, using the"optional"
element.When project X depends on project Y, X will depend only on Y and not on Y's optional dependency Z. The owner of project X may then explicitly add a dependency on Z, at her option. (It may be helpful to think of optional dependencies as "excluded by default.")
Then the optional
dependency will not be included to our WEB-INF/lib
.
I hope this may help.
Upvotes: 1