Message Boards

Gradle Error When Creating a Liferay Workspace Project

Noah Bowman, modified 3 Years ago.

Gradle Error When Creating a Liferay Workspace Project

New Member Posts: 13 Join Date: 9/28/20 Recent Posts
I am getting the following error immediately after I create a Liferay Workspace Project:

Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-5.6.4-bin.zip'.
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
unable to find valid certification path to requested target
org.gradle.tooling.GradleConnectionException: Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-5.6.4-bin.zip'.
    at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution.getToolingImplementationClasspath(DistributionFactory.java:139)
    at org.gradle.tooling.internal.consumer.loader.CachingToolingImplementationLoader.create(CachingToolingImplementationLoader.java:41)
    at org.gradle.tooling.internal.consumer.loader.SynchronizedToolingImplementationLoader.create(SynchronizedToolingImplementationLoader.java:44)
    at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.onStartAction(LazyConsumerActionExecutor.java:104)
    at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.run(LazyConsumerActionExecutor.java:86)
    at org.gradle.tooling.internal.consumer.connection.CancellableConsumerActionExecutor.run(CancellableConsumerActionExecutor.java:45)
    at org.gradle.tooling.internal.consumer.connection.ProgressLoggingConsumerActionExecutor.run(ProgressLoggingConsumerActionExecutor.java:61)
    at org.gradle.tooling.internal.consumer.connection.RethrowingErrorsConsumerActionExecutor.run(RethrowingErrorsConsumerActionExecutor.java:38)
    at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:60)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
    at java.lang.Thread.run(Unknown Source)...

I am using Java JDK 8 and Liferay Developer Studio version: 3.8.1.202004240132-ga2

The steps I followed to create the project are: File -> New -> Liferay Workspace Project



When I create the project with these settings, I get the error

​​​​​​​

thumbnail
Lawrence Lee, modified 3 Years ago.

RE: Gradle Error Marker When Creating a Liferay Workspace Project

New Member Posts: 15 Join Date: 3/11/10 Recent Posts
I ran into a similar issue when trying to import a Liferay Workspace with jdk 8. The team was able to fix the issue that the  eclipse was trying to import  jdk11. Can you try the recent release to see if your issue is resolved? https://releases-cdn.liferay.com/tools/ide/3.9.0/
Noah Bowman, modified 3 Years ago.

RE: Gradle Error When Creating a Liferay Workspace Project

New Member Posts: 13 Join Date: 9/28/20 Recent Posts
Maybe I misunderstand what you mean, but I believe my developer studio is already the latest available.
thumbnail
Lawrence Lee, modified 3 Years ago.

RE: Gradle Error When Creating a Liferay Workspace Project

New Member Posts: 15 Join Date: 3/11/10 Recent Posts
There is a Dev Studio 3.9.0 available. I think you can use the updateSite I linked to update to the latest. The new Liferay Workspace Project settings have been simplified. 
Noah Bowman, modified 3 Years ago.

RE: Gradle Error When Creating a Liferay Workspace Project

New Member Posts: 13 Join Date: 9/28/20 Recent Posts
I downloaded that version (3.9.0) but still see the same error when I create a new project.
thumbnail
Christoph Rabel, modified 3 Years ago.

RE: Gradle Error When Creating a Liferay Workspace Project

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts
Which version of the JDK 8 do you use? (e.g. "java -version" in the commandline to check)
Are you in a company network? Is there a proxy between you and the internet? When you connect in a browser from your computer to https://services.gradle.org/distributions/ , can you check the certificate? Is it from Cloudflare, issued 5.7.2020, certified by digicert.com? Or do you see something else?
Noah Bowman, modified 3 Years ago.

RE: RE: Gradle Error When Creating a Liferay Workspace Project

New Member Posts: 13 Join Date: 9/28/20 Recent Posts

java version "1.8.0_271"
Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.271-b09, mixed mode)

I'm on my home network, but company domain. I have not configured a proxy. When I access https://services.gradle.org/distributions/, I see something different than what you have listed as the certificate.

thumbnail
Andre Kreienbring, modified 3 Years ago.

RE: Gradle Error When Creating a Liferay Workspace Project

Regular Member Posts: 152 Join Date: 12/18/06 Recent Posts

Did you try removing the [user]\.gradle\caches Folder? I once had a similar problem and solved it like that.

thumbnail
Andre Kreienbring, modified 3 Years ago.

RE: Gradle Error When Creating a Liferay Workspace Project

Regular Member Posts: 152 Join Date: 12/18/06 Recent Posts

Hi, I just had the very same issue as I upgraded to Eclipse 202009 and Liferay IDE 3.9.0 on Windows 10.

 

I think that there are more than 1 single issue.

1. I had to delete my whole .grale folder. Without doing this I could not get any further.

2. 202009 comes with it's own JAVA distribution (and therefor with some problems, obviously) At least my Wildfly runtime didn't like this and I had to add my installed JDK 11 as the runtime environment to fix this. This may affect the Gralde builds as well. After adding a gradle.properties file to the .gradle folder with the single line of content:

org.gradle.java.home=C:\\Program Files\\Java\\jdk-11

the java errors were history. But then I faced error number..

3. Due to a TLS Handshake error gradle could not download things from the

https://repository-cdn.liferay.com/nexus/content/groups/public

The only workaround I could find was to change this line in gradle.settings to use the http protocol instead.

Funny, when using Eclipse 202006 and IDE 3.8.1 on the same computer and the same JAVA version I did not see any of these issues.

I like using HTTPS. So if someone knows how I can revert that setting, please let me know.

Noah Bowman, modified 3 Years ago.

RE: Gradle Error When Creating a Liferay Workspace Project (Answer)

New Member Posts: 13 Join Date: 9/28/20 Recent Posts

I was able to notice a consistent problem when downloading dependencies. My machine is authenticated by my company's certificate, so I had to add an entry to the java cert store for the IDE to recognize network activity as valid.

This is the command I ran (as admin) in cmd (Windows 10):

keytool -importcert -file ".crt file path" -keystore "C:\Program Files\Java\jre1.8.0_271\lib\security\cacerts" -alias "my alias"

This is the article I referenced when creating the command https://stackoverflow.com/questions/684081/importing-ssl-certificate-into-eclipse

Hopefully this reaches anyone who might be running into this same problem. I could not find anything about this issue on the community or Liferay's documentation.

thumbnail
Dan Griffiths, modified 2 Years ago.

RE: Gradle Error When Creating a Liferay Workspace Project

New Member Posts: 8 Join Date: 6/25/20 Recent Posts

Don't know if anybody is still monitoring this thread but I am facing exactly the same issue.

It makes perfect sense that I would need to import a certificate into the Java keystore but I don't really understand where to obtain the certificate that needs to be imported; Noah refers to it as ".crt file path". Do I actually need to create it myself or can I find it somewhere?

thumbnail
Dan Griffiths, modified 2 Years ago.

RE: Gradle Error When Creating a Liferay Workspace Project

New Member Posts: 8 Join Date: 6/25/20 Recent Posts

I have discovered the answer (in my case, at least):

To export the certificate I needed from the system.

In Chrome, I opened https://services.gradle.org/distributions/ and clicked on the padlock on the left of the URL, -> Connection is secure -> Certificate is validOn the Certificate Path tab, note the name of the root certificate

Go to the Chrome Settings to the right of the URL. Select Privacy and Security -> Secuurity -> Manage Certificates


Click on the root certificate mentioned above and then use the wizard under the Export button to create a .cer file (.cer and .crt are the same thing)