Gokulnath Kumar
Gokulnath Kumar

Reputation: 169

Gradle build is getting failed

I am quite new to gradle world and I am trying to build a java project and publish the resulting artifacts to the repository.

As part of the build, I am getting the below error message, some pointers on how to fix the below issue would be helpful.

Gradle Build:

$ gradle build --info
Initialized native services in: /var/lib/jenkins/.gradle/native
The client will now receive all logging from the daemon (pid: 4587). The daemon log file: /var/lib/jenkins/.gradle/daemon/4.9/daemon-4587.out.log
Starting 42nd build in daemon [uptime: 4 hrs 26 mins 46.465 secs, performance: 99%]
Using 4 worker leases.
Starting Build
Settings evaluated using settings file '/var/lib/jenkins/gradle_projects/settings.gradle'.
Projects loaded. Root project using build file '/var/lib/jenkins/gradle_projects/build.gradle'.
Included projects: [root project 'hello-world']

> Configure project :
Evaluating root project 'hello-world' using build file '/var/lib/jenkins/gradle_projects/build.gradle'.

FAILURE: Build failed with an exception.

* Where:
Build file '/var/lib/jenkins/gradle_projects/build.gradle' line: 32

* What went wrong:
A problem occurred evaluating root project 'hello-world'.
> Could not find method artifactory() for arguments [build_en65a4pmtkipo6cwvlcm8w7ky$_run_closure3@3ea141a7] on root project 'hello-world' of type org.gradle.api.Project.

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.9/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 0s

Upvotes: 0

Views: 2217

Answers (1)

M.Ricciuti
M.Ricciuti

Reputation: 12116

This error is because you are trying to configure the Artifactory plugin ( artifactory block) but you did not apply the Artifactory plugin to your project. Try to import the plugin as follow:

buildscript {
   // EDIT
   repositories {
       // ...
       jcenter()
   }
  dependencies {
    // ...
    classpath "org.jfrog.buildinfo:build-info-extractor-gradle:latest.release"  // <- this line is missing in your script
  }
}

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: "com.jfrog.artifactory"  // <-- this one is missing in your script

Refer to the plugin official documentation for full configuration examples : https://www.jfrog.com/confluence/display/RTF/Gradle+Artifactory+Plugin

Upvotes: 1

Related Questions