Exclude gwt jars


(Mark Waschkowski) #1

I’ve searched and searched, but haven’t been able to find a good exclude example. I would like to exclude gwt jars from the runtime, and have tried this, but no success:

// Dependencies dependencies{

//remove from runtime

providedRuntime (‘com.google.gwt:gwt-user:2.3.0’)

compile (‘com.google.gwt:gwt-user:2.3.0’){

//disabling all transitive dependencies of this dependency

transitive = false

} }

Any help much appreciated!

Mark


(Mark Waschkowski) #2

Here is the code in code tags:

// Dependencies
 dependencies{
     //remove from runtime
     providedRuntime ('com.google.gwt:gwt-user:2.3.0')
      compile ('com.google.gwt:gwt-user:2.3.0'){
         //disabling all transitive dependencies of this dependency
         transitive = false
     }
  }

(spencer_allain) #3

The answer is going to depend somewhat upon what your runtime looks like, but since you’ve listed providedCompile as a configuration, I’m assuming that you’ve applied the war plugin. In that instance, what you want is ‘com.google.gwt:gwt-user:2.3.0’ to be a providedCompile dependency.

dependencies {
    providedCompile 'com.google.gwt:gwt-user:2.3.0'
}

-Spencer


(Peter Niederwieser) #4

Can you elaborate on what exactly the goal is? Is this about which Jars make it into the War, or about something else?


(Mark Waschkowski) #5

Thanks for the suggestions. Oh certainly, I can be more clear - gwt dependencies are required at compile time, but after compilation you are left with html and javascript, and don’t require the gwt libs any more.

ie. needed for compilation, not for runtime


(ruediger.schobbert) #6

You might want to consider a new configuration (besides that you might also want to configure a sourceSet just for gwt code):

configurations {
    gwt
}
  dependencies {
          // ... more dependencies here ...
          compile
     group:'com.google.gwt',
    name:'gwt-servlet',
         version:'2.4.0', transitive: false
    gwt
         group:'com.google.gwt',
    name:'gwt-dev',
             version:'2.4.0', transitive: false
    gwt
         group:'com.google.gwt',
    name:'gwt-user',
            version:'2.4.0', transitive: false
}

(Mark Waschkowski) #7

Thanks Spencer, that was the ticket.

As well, I realized that these libraries are not transitive, so setting transitive=false doesn’t really help…