liferay / liferay-mobile-sdk

Other
47 stars 56 forks source link

Gradle & Maven deprecated clear HTTP calls #80

Open frangeveris opened 4 years ago

frangeveris commented 4 years ago

Gradle deprecated the http calls early this year, and Maven followed suit. That means we cannot use the 6.2.0.18 builder to generate new versions of the services library. Our client won't upgrade to Liferay 7 from 6.2, so we're stuck with this version of the builder. Is there any alternative to this or any plan of changing the http calls in the SDK to https?

victorg1991 commented 4 years ago

Hey @frangeveris

The HTTP calls that the builder is doing are targetting your localhost server installation right?

frangeveris commented 4 years ago

Hi @victorg1991 When I do gradlew generate, I get this error

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':builder:compile'.
> Could not download artifact 'org.apache.httpcomponents:httpclient:4.2.5:httpclient.jar'
   > Could not GET 'http://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient/4.2.5/httpclient-4.2.5.jar'. Received status code 501 from server: HTTPS Required

These are the http calls I meant

gotamafandy commented 4 years ago

you can add

maven {
     url = 'https://repo.maven.apache.org/maven2'
}

into your build.gradle in root project.

your build.gradle will be look like this after adding new https url

ext {
    tasksGroup = 'Liferay'
}

allprojects {
    repositories {
        mavenLocal()
        mavenCentral()
        maven {
               url = 'https://repo.maven.apache.org/maven2'
            }
    }
}
frangeveris commented 4 years ago

Hi @gotamafandy ! I did as you said and we still get error when generating the libraries: Here's the debug output https://pastebin.com/4Z5ikVra And here's the exception stacktrace https://pastebin.com/8ageeiWz

Please, let me know if there's any other piece of info that you could need. Thanks in advance!

pravinsurvase commented 4 years ago

Hi,

Unable to build the customer SDK for Liferay Ver 6.2 and SDK builder version 6.2.0.17.

Made suggest changes in build.gradle at root directory.

Could not resolve all dependencies for configuration ':builder:compile'.

Could not resolve org.apache.httpcomponents:httpclient:4.2.5. Required by: com.liferay.mobile:builder:6.2.0.17 Could not HEAD 'https://repo.maven.apache.org/maven2/org/apache/httpcomponents/httpclient/4.2.5/httpclient-4.2.5.pom'. peer not authenticated Could not resolve org.apache.velocity:velocity:1.7. Required by: com.liferay.mobile:builder:6.2.0.17 Could not HEAD 'https://repo.maven.apache.org/maven2/org/apache/velocity/velocity/1.7/velocity-1.7.pom'. peer not authenticated Could not resolve org.apache.velocity:velocity-tools:2.0. Required by: com.liferay.mobile:builder:6.2.0.17 Could not HEAD 'https://repo.maven.apache.org/maven2/org/apache/velocity/velocity-tools/2.0/velocity-tools-2.0.pom'. peer not authenticated Could not resolve org.json:json:20140107. Required by: com.liferay.mobile:builder:6.2.0.17 Could not HEAD 'https://repo.maven.apache.org/maven2/org/json/json/20140107/json-20140107.pom'. peer not authenticated

Kindly help ...

victorg1991 commented 4 years ago

Hey, I've pushed some commits to master, you should be able to generate 6.2 services.

Could you clone the repo and try again? You should execute gradlew createModule -Pall --console plain --no-daemon and select version 62

frangeveris commented 4 years ago

Hi @victorg1991 I just tried it, both on Windows Power Shell and Git Bash. In both cases, I didn't get the prompt to enter data, just went straight to an exception. Apparently, it attempts to unzip an empty zip file?

`git checkout tags/builder-6.2.0.18 -b builder-6.2.0.18 ./gradlew createModule -P=all --console plain --no-daemon

Unzipping C:\Users\fgarcgar.gradle\wrapper\dists\gradle-1.11-all\7qd8qq8te5j4f5q9aaei3gh3lj\gradle-1.11-all.zip to C:\Users\fgarcgar.gradle\wrapper\dists\gradle-1.11-all\7qd8qq8te5j4f5q9aaei3gh3lj Exception in thread "main" java.lang.RuntimeException: java.util.zip.ZipException: zip file is empty at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78) at org.gradle.wrapper.Install.createDist(Install.java:44) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:58) Caused by: java.util.zip.ZipException: zip file is empty at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.(ZipFile.java:225) at java.util.zip.ZipFile.(ZipFile.java:155) at java.util.zip.ZipFile.(ZipFile.java:169) at org.gradle.wrapper.Install.unzip(Install.java:157) at org.gradle.wrapper.Install.access$400(Install.java:26) at org.gradle.wrapper.Install$1.call(Install.java:67) at org.gradle.wrapper.Install$1.call(Install.java:44) at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65) ... 3 more `

victorg1991 commented 4 years ago

hey @frangeveris are you using the latest commit from master? It seems that is trying to use gradle 1.11, but the gradle version in master is 5. If you are in the latest commit of master can you do a clean clone again, or just remove the .gradle folder? :)

victorg1991 commented 4 years ago

Oh I've seen that you were using the tags/builder-6.2.0.18, you should use the latest commit of master, not that particular tag

frangeveris commented 4 years ago

An error message prompted me to use --stacktrace, so I reran the script with that additional option and pasted the output here https://pastebin.com/eHmiCXLg

victorg1991 commented 4 years ago

@frangeveris It was mandatory to have the android sdk installed in your machine, I've pushed a commit to fix this, can you fetch the new changes and try again, please?

frangeveris commented 4 years ago

Hi @victorg1991 It finally generates the module, but gradlew jar fails with SDK location not found. Before the deprecation, I did generate this module on this same computer. Never uninstalled or changed anything android-related since installation.

Here's the output run with --stacktrace https://pastebin.com/PKGimdiu

Thanks for your effort ;)

pravinsurvase commented 4 years ago

Hi @victorg1991

Downloaded latest master.zip. See below the steps followed. The build is successful however under module directory empty portlet folder is created.

Kindly let me know how to resolve this or guide me if I'm doing something incorrect.

E:\Liferay\liferay-mobile-sdk-master>gradlew createModule -Pall --console plain --no-daemon Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=256m; support was removed in 8.0 Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0 Picked up _JAVA_OPTIONS: -Xmx512M  Context [portal,asset,assetlist,audit,backgroundtask,blogs,bookmarks,calendar,comment,ddl,ddm,flags,fragment,journal,kaleo,kb,layout,marketplace,mb,mdr,microblogs,opensocial-portlet,polls,powwow-portlet,pushnotifications,sap,screens,segments,sharing,sitenavigation,sync,sync-web,tasks-portlet,trash,wedeployauth,wiki]: mor-portlet Platforms [android,ios,windows]: android Server URL [http://localhost:8080]: http://localhost:8082 Filter:  Portal Version [72]: > Task :createModule 62 Module Version [1.0]: 1.0 Package Name [com.liferay.mobile.android]: com.liferay.mobile.android.mor POM Description: SDK MOR Module was successfully created at E:\Liferay\liferay-mobile-sdk-master/modules/mor-portlet/. SDK Builder will generate now all services with the details you provided.

BUILD SUCCESSFUL in 1m 16s 1 actionable task: 1 executed

Thanks for helping us !!!!

Regards Pravin

pravinsurvase commented 4 years ago

Hi @victorg1991

Downloaded latest master.zip. See below the steps followed. The build is successful however under module directory empty portlet folder is created.

Kindly let me know how to resolve this or guide me if I'm doing something incorrect.

E:\Liferay\liferay-mobile-sdk-master>gradlew createModule -Pall --console plain --no-daemon Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=256m; support was removed in 8.0 Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0 Picked up _JAVA_OPTIONS: -Xmx512M �[33m Context�[36m [portal,asset,assetlist,audit,backgroundtask,blogs,bookmarks,calendar,comment,ddl,ddm,flags,fragment,journal,kaleo,kb,layout,marketplace,mb,mdr,microblogs,opensocial-portlet,polls,powwow-portlet,pushnotifications,sap,screens,segments,sharing,sitenavigation,sync,sync-web,tasks-portlet,trash,wedeployauth,wiki]�[33m: �[37mmor-portlet �[33mPlatforms�[36m [android,ios,windows]�[33m: �[37mandroid �[33mServer URL�[36m [http://localhost:8080]�[33m: �[37mhttp://localhost:8082 �[33mFilter: �[37m �[33mPortal Version�[36m [72]�[33m: �[37m> Task :createModule 62 �[33mModule Version�[36m [1.0]�[33m: �[37m1.0 �[33mPackage Name�[36m [com.liferay.mobile.android]�[33m: �[37mcom.liferay.mobile.android.mor �[33mPOM Description: �[37mSDK MOR �[32mModule was successfully created at E:\Liferay\liferay-mobile-sdk-master/modules/mor-portlet/.�[37m �[32mSDK Builder will generate now all services with the details you provided.�[37m

BUILD SUCCESSFUL in 1m 16s 1 actionable task: 1 executed

Thanks for helping us !!!!

Regards Pravin

On Friday, 29 May, 2020, 05:19:13 pm IST, Victor Galan notifications@github.com wrote:

@frangeveris It was mandatory to have the android sdk installed in your machine, I've pushed a commit to fix this, can you fetch the new changes and try again, please?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

victorg1991 commented 4 years ago

@frangeveris Configuring the android SDK should solve that problem, anyway I've pushed a fix for this not to be mandatory. You should be able to execute jar task without having the android SDK

@pravinsurvase Did you execute ../../gradlew generatefrom the folder that createModule task generated? That task should create a directory with a gradle.properties file only

frangeveris commented 4 years ago

Hi @victorg1991

I've noticed something new with the latest pull: the gradlew generate builds successfully but outputs a JSONException

../../gradlew generate --stacktrace                           
> Task :modules-mcd-service-portlet:generate
jun 01, 2020 8:23:16 AM com.liferay.mobile.sdk.SDKBuilder main
GRAVE: org.json.JSONException: A JSONObject text must begin with '{' at 202 [character 1 line 168]
java.io.IOException: org.json.JSONException: A JSONObject text must begin with '{' at 202 [character 1 line 168]
        at com.liferay.mobile.sdk.http.DiscoveryResponseHandler.handleResponse(DiscoveryResponseHandler.java:38)
        at com.liferay.mobile.sdk.http.DiscoveryResponseHandler.handleResponse(DiscoveryResponseHandler.java:28)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:223)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:165)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:140)
        at com.liferay.mobile.sdk.SDKBuilder.discover(SDKBuilder.java:126)
        at com.liferay.mobile.sdk.SDKBuilder.build(SDKBuilder.java:75)
        at com.liferay.mobile.sdk.SDKBuilder.main(SDKBuilder.java:53)
Caused by: org.json.JSONException: A JSONObject text must begin with '{' at 202 [character 1 line 168]
        at org.json.JSONTokener.syntaxError(JSONTokener.java:505)
        at org.json.JSONObject.<init>(JSONObject.java:215)
        at org.json.JSONObject.<init>(JSONObject.java:399)
        at com.liferay.mobile.sdk.http.Discovery.<init>(Discovery.java:31)
        at com.liferay.mobile.sdk.http.DiscoveryResponseHandler.handleResponse(DiscoveryResponseHandler.java:35)
        ... 7 more

But since it says the build was successful, I went on and executed the gradlew jar, which failed with the following output: https://pastebin.com/M6nsB4Ui

pravinsurvase commented 4 years ago

Hi @victorg1991

Need one clarification: Is the generation of custom portlet mobile SDK dependent on liferay master mobile SDK i.e. liferay-mobile-sdk-master?

Initially few days I had old liferay-mobile-sdk-master and I tried building custom SDK with liferay-mobile-sdk-android-6.2.0.17 (i.e. createModule and jar) it had multiple issues.

Now as per your advice I downloaded latest liferay-mobile-sdk-master and performed tasks i.e. createModule and Generate. This did not produce custom portlet mobile SDK but generated liferay mobile SDK files. I couldn't generate jar file for it.

Then I tried running commands for building custom mobile SDK under liferay-mobile-sdk-android-6.2.0.17 i.e. createModule and jar ...it successfully generated custom portlet SDK along with Jar. However I need to test it in android application.

Now the question is I do not have latest liferay-mobile-sdk-master jar? How can I get it or build it? or Can I use old liferay-mobile-sdk-master jar i.e. liferay-android-sdk-6.2.0.17.jar?

Regards Pravin

pravinsurvase commented 4 years ago

Hi @victorg1991

Need one clarification: Is the generation of custom portlet mobile SDK dependent on liferay master mobile SDK i.e. liferay-mobile-sdk-master?

Initially few days I had old liferay-mobile-sdk-master and I tried building custom SDK with liferay-mobile-sdk-builder-6.2.0.17  (i.e. createModule and jar) it had multiple issues.

Now as per your advice I downloaded latest liferay-mobile-sdk-master and performed tasks i.e. createModule and Generate. This did not produce custom portlet mobile SDK but generated liferay mobile SDK files. I couldn't generate jar file for it.

Then I tried running commands for building custom mobile SDK under liferay-mobile-sdk-builder-6.2.0.17 i.e. createModule and jar ...it successfully generated custom portlet SDK along with Jar. However I need to test it in android application.

Now the question is I do not have latest liferay-mobile-sdk-master jar? How can I get it or build it? or Can I use old liferay-mobile-sdk-master jar i.e. liferay-android-sdk-6.2.0.17.jar?

Regards Pravin

On Monday, 1 June, 2020, 11:45:35 am IST, Victor Galan notifications@github.com wrote:

@frangeveris Configuring the android SDK should solve that problem, anyway I've pushed a fix for this not to be mandatory. You should be able to execute jar task without having the android SDK

@pravinsurvase Did you execute ../../gradlew generate from the folder that createModule task generated? That task should create a directory with a gradle.properties file only

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

victorg1991 commented 4 years ago

@frangeveris There is a problem with the DDLRecord service that generates two methods with the same signature, you have to edit the conflictive file and remove one of those. That being said, do you want to generate all the services of your instance or just a couple of them? Because I think some of those services are included in the android-mobile-sdk library so it will be some clashing if you import the library.

victorg1991 commented 4 years ago

@pravinsurvase Can you share the error that you are getting? did you check that the services you want to generate are available in /api/jsonws of your instalation?