I have written code for Google Analytics API in Liferay DXP. I have imported the following jars by writing them in build.gradle
compile group: 'commons-logging', name: 'commons-logging', version: '1.1.1'
compile group: 'com.google.api-client', name: 'google-api-client', version: '1.22.0'
compile group: 'com.google.api-client', name: 'google-api-client-appengine', version: '1.22.0'
compile group: 'com.google.api-client', name: 'google-api-client-gson', version: '1.22.0'
compile group: 'com.google.http-client', name: 'google-http-client-jackson2', version: '1.22.0'
compile group: 'com.google.api-client', name: 'google-api-client-java6', version: '1.22.0'
compile group: 'com.google.api-client', name: 'google-api-client-servlet', version: '1.22.0'
compile group: 'com.google.apis', name: 'google-api-services-analytics', version: 'v3-rev132-1.22.0'
compile group: 'com.google.http-client', name: 'google-http-client', version: '1.22.0'
compile group: 'com.google.http-client', name: 'google-http-client-appengine', version: '1.22.0'
compile group: 'com.google.http-client', name: 'google-http-client-gson', version: '1.22.0'
compile group: 'com.google.http-client', name: 'google-http-client-jackson2', version: '1.22.0'
compile group: 'com.google.http-client', name: 'google-http-client-jdo', version: '1.22.0'
compile group: 'com.google.oauth-client', name: 'google-oauth-client', version: '1.22.0'
compile group: 'com.google.oauth-client', name: 'google-oauth-client-appengine', version: '1.22.0'
compile group: 'com.google.oauth-client', name: 'google-oauth-client-java6', version: '1.22.0'
compile group: 'com.google.oauth-client', name: 'google-oauth-client-jetty', version: '1.22.0'
compile group: 'com.google.oauth-client', name: 'google-oauth-client-servlet', version: '1.22.0'
compile group: 'com.google.code.gson', name: 'gson', version: '2.1'
compile group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.0.1'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.1.3'
compile group: 'javax.jdo', name: 'jdo2-api', version: '2.3-eb'
compile group: 'org.mortbay.jetty', name: 'jetty', version: '6.1.26'
compile group: 'org.mortbay.jetty', name: 'jetty-util', version: '6.1.26'
compile group: 'com.google.code.findbugs', name: 'jsr305', version: '1.3.9'
compile group: 'javax.transaction', name: 'transaction-api', version: '1.1'
Also I have included the same in bnd.bnd file using the following code:
Include-Resource: @google-api-client-1.22.0.jar,@google-http-client-1.22.0.jar,@google-api-client-java6-1.22.0.jar,@google-http-client-jackson2-1.22.0.jar,@google-http-client-gson-1.22.0.jar,@google-oauth-client-1.22.0.jar,@google-oauth-client-java6-1.22.0.jar,@gson-2.1.jar,@google-api-services-analytics-v3-rev132-1.22.0.jar,@jackson-core-2.1.3.jar,@commons-logging-1.1.1.jar,@google-api-client-appengine-1.22.0.jar,@google-api-client-gson-1.22.0.jar,@google-api-client-servlet-1.22.0.jar,@google-api-services-analytics-v3-rev132-1.22.0.jar,@google-http-client-appengine-1.22.0.jar,@google-http-client-jackson2-1.22.0.jar,@google-http-client-jdo-1.22.0.jar,@google-oauth-client-appengine-1.22.0.jar,@google-oauth-client-jetty-1.22.0.jar,@google-oauth-client-servlet-1.22.0.jar,@gson-2.1.jar,@httpcore-4.0.1.jar,@jackson-core-2.1.3.jar,@jdo2-api-2.3-eb.jar,@jetty-6.1.26.jar,@jetty-util-6.1.26.jar,@jsr305-1.3.9.jar,@transaction-api-1.1.jar
The module compiles fine and I am able to get jar. But when I deploy this jar on server I keep getting Unresolved requirement:Import-Package: error.
I know that the issue is with the Transitive dependencies. I read somewhere on Liferay community that the things that we mention in build.gradle is available at compile time and it does not looks for Transitive dependencies at compile time but at runtime we need to have transitive dependencies as well.
Isnt there any way that Gradle can download transitive dependencies on its own instead of me mentioning them individually in build.gradle file.