facebook

Number of Dependencies, jars don’t match

  1. MyEclipse IDE
  2.  > 
  3. Maven for MyEclipse (Maven4MyEclipse)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #302844 Reply

    rharri
    Member

    I’m using MyEclipse 7.1.1 and have created a web project using maven4myeclipse. My pom.xml file contains 30 dependencies, navigator shows 39 files under the lib directory, the deployed project has 56 files under the lib directory and the package explorer has 67 files under the heading of Maven dependencies. Is this right? And if right, why are the locations so different?

    Thanks,
    Bob

    #302869 Reply

    @rharri wrote:

    My pom.xml file contains 30 dependencies,

    These are Maven depndencies that your application directly requires.

    @rharri wrote:

    navigator shows 39 files under the lib directory

    Do you mean the Resource/Project Navigator? If yes – these are the files you put into that folder.

    @rharri wrote:

    the deployed project has 56 files under the lib directory

    These are:
    1. Files copied from the WEB-INF/lib folder in your projects.
    2. Maven dependency jars for dependencies (direct and indirect) that have scope other then “provided” or “test”

    @rharri wrote:

    and the package explorer has 67 files under the heading of Maven dependencies.

    These are all dependency jars for all dependencies (direct/indirect) regardless of the scope. They are needed for the compile-time but not the deployment.

    @rharri wrote:

    Is this right?

    Depends on your requirements. In most cases you don’t need to put any jars into WEB-INF/lib but declare the dependency in pom.xml instead.

    @rharri wrote:

    And if right, why are the locations so different?

    The dependency jars are not added to your workspace project. Project references jars in local Maven repository – this saves some drive space and makes it easier to work with source control systems.
    Some Maven dependencies should not be deployed to a server as a part of the web application:
    1. Jars that are provided by server vendor (i.e. Servlet API jars – they are part of the servlet container but you also need that jar referenced at compile time so you can use those classes in your code. These are declared as Maven dependencies with “provided” scope.
    2. Jars that are needed for unit tests. They have “test” scope.

    So anything you put into WEB-INF/lib has nothing to do with Maven. It is blindly deployed/added to classpath by IDE.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Number of Dependencies, jars don’t match

You must be logged in to post in the forum log in