I wrote a Liferay 7 module that uses org.apache.http.client.methods.HttpPost.
The needed OSGi components are:
mvn:org.apache.httpcomponents/httpclient-osgi/4.5.3
mvn:org.apache.httpcomponents/httpcore-osgi/4.4.6
Uber Module
Now I am trying a build an Uber Module containing these JARs plus my code, per Option 3 - Make An Uber Module.
So, I manually downloaded the two JARs to my project, then added this to my build.gradle
:
runtime group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.3'
runtime group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.6'
... and this to my bnd.bnd
:
Include-Resource: @httpclient-osgi-4.5.3.jar
Include-Resource: @httpcore-osgi-4.4.6.jar
Problem
When I try to compile, at the compileJava
step I immediately get:
error: package org.apache.http does not exist
Adding compileOnly
groups in addition to the runtime
groups in build.gradle
seems to solve the problem, but is it the right thing to do?