• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JAR File is included in WAR File inspite of mentioning scope as provided in maven

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was under the impression that when I make the "scope" of a "Jar" as "provided" in maven, then that would not be included in the WAR file(available only at the compile tile). Hence I mentioned scope as "provided"(JMS jar) in the pom.xml file, but I still see that jar file in the lib folder of WAR file. Does anybody know What I am missing here or is my understanding incorrect?



Thank you!!
 
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your assumption is correct. "Provided" means that the JAR in question is provided by the service container, which is true for full-stack J(2)EE servers.

Most likely, one of the following is to blame:

1. It isn't the jar you think it is. In some instances, there's an API jar that defines the standard interfaces and an implementation jar that actually provides the services themselves. So you might be pulling in an API jar from some other part of the POM and thinking it's the implementation jar.

2. You might have a complication in your build. For example, I can set up a "universal" build with different profiles in it - say one for Tomcat and one for WebSphere. Since Tomcat doesn't implement jms itself, but WebSphere does, the profile would ensure that builds for Tomcat included the jar but builds for WebSphere did not. So if you build using the wrong profile, you get unexpected consequences.
 
Saloon Keeper
Posts: 15529
364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post your complete POM?
 
Naresh Shanmugam
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Tim and Stephan for your response.

As Tim mentioned,

It isn't the jar you think it is. In some instances, there's an API jar that defines the standard interfaces and an implementation jar that actually provides the services themselves. So you might be pulling in an API jar from some other part of the POM and thinking it's the implementation jar.



the JMS Jar that I had mentioned in my post was getting downloaded as a transitive dependency of some other dependent component. I figured this out by opening the pom.xml in STS (Dependencies Hierarchy View) that showed all the transitive dependencies.  
Since we dont have control over the external pom. We used the following code to remove that JAR file from the WAR file.



I am positing this so that it would be helpful to some one else.
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If JMS is a direct dependency of one of your dependencies you can also exclude it. For instance:
 
reply
    Bookmark Topic Watch Topic
  • New Topic