Results 1 to 5 of 5
  1. #1
    pretbrat is offline Member
    Join Date
    Jul 2014
    Posts
    3
    Rep Power
    0

    Default Identifying dependencies and excluding them

    I have the following dependencies in my pom.xml:
    Java Code:
    		<dependency>
    			<groupId>org.atmosphere</groupId>
    			<artifactId>atmosphere-jersey</artifactId>
    			<version>1.0.12</version>
    		</dependency>
    		<dependency>
    			<groupId>com.sun.jersey</groupId>
    			<artifactId>jersey-json</artifactId>
    			<version>1.12</version>
    		</dependency>
    		<dependency>
    			<groupId>javax.servlet</groupId>
    			<artifactId>servlet-api</artifactId>
    			<version>2.4</version>
    		</dependency>
    
    		<!-- Swagger dependenccy for documentation -->
    		<dependency>
    			<groupId>com.wordnik</groupId>
    			<artifactId>swagger-jaxrs_2.9.1</artifactId>
    			<version>1.2.0</version>
    			<scope>compile</scope>
    		</dependency>
    		<!-- Test dependency -->
    		<dependency>
    			<groupId>com.sun.jersey.jersey-test-framework</groupId>
    			<artifactId>jersey-test-framework-external</artifactId>
    			<version>1.12</version>
    			<scope>test</scope>
    		</dependency>
    		<!-- Test dependency -->
    		<dependency>
    			<groupId>com.sun.jersey.contribs.jersey-oauth</groupId>
    			<artifactId>oauth-client</artifactId>
    			<version>1.12</version>
    		</dependency>
    		<dependency>
    			<groupId>com.sun.jersey.contribs.jersey-oauth</groupId>
    			<artifactId>oauth-server</artifactId>
    			<version>1.12</version>
    		</dependency>
    		<dependency>
    			<groupId>com.sun.jersey.contribs.jersey-oauth</groupId>
    			<artifactId>oauth-signature</artifactId>
    			<version>1.12</version>
    		</dependency>
    One of them generates jsr311-api (javax.ws.rs.3.1.1 api) jar and I don't know which. How do I find what is generating this jar?
    I actually want the jsr339-api jar to use javax.ws.rs.2.0 api, for which I added a separate dependency and I get the jar successfully. But project-properties under Libraries -> maven dependencies shows both jars (311 and 339). How do I remove dependency on 311? All options are disabled in that window.

    Is there a way I can do this?

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,266
    Rep Power
    6

    Default Re: Identifying dependencies and excluding them

    Well two ways to find out where the transient dependency is coming from.

    Works always: mvn dependency:tree
    Easier to see: use the Eclipse m2eclipse plugin which provides a graphical view of the dependency tree if you open the pom.xml in the editor.

    As to removing it, you can:

    - add an exclusion on the dependency which transiently provides it; cleaner but lots of micromanagement is not nice
    - define the dependency in your own project's dependency management and scope it as provided

    Documentation is as per usual your friend:

    Maven - Optional Dependencies and Dependency Exclusions
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    pretbrat is offline Member
    Join Date
    Jul 2014
    Posts
    3
    Rep Power
    0

    Default Re: Identifying dependencies and excluding them

    Quote Originally Posted by gimbal2 View Post
    Well two ways to find out where the transient dependency is coming from.

    Works always: mvn dependency:tree
    Easier to see: use the Eclipse m2eclipse plugin which provides a graphical view of the dependency tree if you open the pom.xml in the editor.

    As to removing it, you can:

    - add an exclusion on the dependency which transiently provides it; cleaner but lots of micromanagement is not nice
    - define the dependency in your own project's dependency management and scope it as provided

    Documentation is as per usual your friend:

    Maven - Optional Dependencies and Dependency Exclusions
    ----

    Thanks for your response. I see the graphical view in eclipse:

    Identifying dependencies and excluding them-aa.png

    But jsr11 jar seems to be a generated by some dependency indirectly. I don;t see that.

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,266
    Rep Power
    6

    Default Re: Identifying dependencies and excluding them

    If one method doesn't seem to provide you the information you need, try the other. Its coming from somewhere, jars don't magically come into existence. Especially not API jars.

    Btw: is there really a problem to fix here? What's your problem with the transient dependency? I'm going to guess it is scoped provided already so it won't ever end up in a deployed module.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    pretbrat is offline Member
    Join Date
    Jul 2014
    Posts
    3
    Rep Power
    0

    Default Re: Identifying dependencies and excluding them

    Quote Originally Posted by gimbal2 View Post
    If one method doesn't seem to provide you the information you need, try the other. Its coming from somewhere, jars don't magically come into existence. Especially not API jars.

    Btw: is there really a problem to fix here? What's your problem with the transient dependency? I'm going to guess it is scoped provided already so it won't ever end up in a deployed module.
    Sorry, I sent that too early.
    mvn dependency:tree was really detailed. I found the source. I am not sure if there is a problem but was thinking it is too confusing to be using two apis. But the older api is being used by swagger documentation and hence it will not affect my other stuff.
    Thanks again :)

Similar Threads

  1. Calculate next Business day excluding weekend and Holidays
    By pratik4891 in forum Advanced Java
    Replies: 1
    Last Post: 11-27-2013, 08:52 PM
  2. identifying a socket exception
    By yemista in forum Networking
    Replies: 2
    Last Post: 12-01-2011, 08:07 PM
  3. Help me ! identifying the mistake
    By o0oNorao0o in forum New To Java
    Replies: 6
    Last Post: 11-06-2010, 11:03 PM
  4. help with identifying components of a gui
    By jaytee in forum New To Java
    Replies: 1
    Last Post: 03-08-2010, 03:28 AM
  5. Creating an array of children while excluding grandchildren.
    By xcallmejudasx in forum Advanced Java
    Replies: 3
    Last Post: 10-28-2008, 10:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •