Hynek Hrabík
Hynek Hrabík

Reputation: 79

gradle build access denied

Hi I'm new to gradle and java and IJ idea. I am trying to build some java project using gradle. When I run command:

C:\Users\xxx\IdeaProjects\example2>gradle build

The build fails.

   FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileTestJava'.
> Could not resolve all files for configuration ':testCompileClasspath'.
   > Could not resolve org.testng:testng:6.14.3.
     Required by:
         project :
      > Could not resolve org.testng:testng:6.14.3.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/testng/testng/6.14.3/testng-6.14.3.pom'.
            > Could not GET 'https://repo.maven.apache.org/maven2/org/testng/testng/6.14.3/testng-6.14.3.pom'.
               > Received fatal alert: access_denied

Folder IdeaProjects/example2 has fully accesible for all users. When I run the command with --stacktrace option, the last "caused by" is:

            ... 106 more
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: access_denied
        at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:396)

Could it be problem with SSL certificate? I'm using proxy to connect to the web.

This is build.gradle file I'm using

plugins {
    id 'java'
    id 'idea'
}

group 'jetbrains'
version '1.0'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    //testCompile group: 'junit', name: 'junit', version: '4.12'
    testCompile group: 'org.testng', name: 'testng', version: '6.14.3'
    // https://mvnrepository.com/artifact/io.rest-assured/rest-assured
    //compile group: 'io.rest-assured', name: 'rest-assured', version: '3.1.0'
    //testCompile group: 'io.rest-assured', name: 'rest-assured', version: '3.1.0'
}

Upvotes: 1

Views: 3765

Answers (1)

Hynek Hrabík
Hynek Hrabík

Reputation: 79

Problem solved, thanks to stackoverflow.com/a/22666646/2987755. Following variables/properties must be set in gradle.properties file.

systemProp.http.proxyHost=$proxy
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=$proxy
systemProp.https.proxyPort=8080

Upvotes: 1

Related Questions