Facing Issue " Task not found in root project "bin" "

Hi Everyone,

I am at downloaded & install gradle on my ubuntu server. I set my Environmental Variable path like:

export PATH=$PATH:/opt/gradle/gradle-4.4.1/bin

gradle version:
Gradle 4.4.1

Build time: 2017-12-20 15:45:23 UTC
Revision: 10ed9dc355dc39f6307cc98fbd8cea314bdd381c

Groovy: 2.4.12
Ant: Apache Ant™ version 1.9.9 compiled on February 2 2017
JVM: 1.8.0_151 (Oracle Corporation 25.151-b12)
OS: Linux 4.4.0-1044-aws amd64

PWD
/opt/gradle/gradle-4.4.1/bin

command:
./gradle clean shadowJar

Error getting:
Task build fail with below error notification:

" Task ‘clean’ not found in root project ‘bin’ "

Please help me in resolving this.

This is incorrect. Your working directory should be the project directory (or you need to specify it manually as a command line argument, but this is atypical), not the bin directory of the Gradle distribution. The Gradle binary will be found via the PATH, from any working directory, using just gradle (no ./).

Right james.Now, I have created a project & after running “gradle init” i ran “./gradlew clean shadowJar”

Now it is giving me Error:
Task ‘shadowJar’ not found in root project ‘projects’

gradle tasks o/p:
:tasks


All tasks runnable from root project

Build tasks

assemble - Assembles the outputs of this project.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
classes - Assembles main classes.
clean - Deletes the build directory.
jar - Assembles a jar archive containing the main classes.
testClasses - Assembles test classes.

Build Setup tasks

init - Initializes a new Gradle build. [incubating]
wrapper - Generates Gradle wrapper files. [incubating]

Documentation tasks

groovydoc - Generates Groovydoc API documentation for the main source code.
javadoc - Generates Javadoc API documentation for the main source code.

Help tasks

buildEnvironment - Displays all buildscript dependencies declared in root project ‘projects’.
components - Displays the components produced by root project ‘projects’. [incubating]
dependencies - Displays all dependencies declared in root project ‘projects’.
dependencyInsight - Displays the insight into a specific dependency in root project ‘projects’.
help - Displays a help message.
model - Displays the configuration model of root project ‘projects’. [incubating]
projects - Displays the sub-projects of root project ‘projects’.
properties - Displays the properties of root project ‘projects’.
tasks - Displays the tasks runnable from root project ‘projects’.

Verification tasks

check - Runs all checks.
test - Runs the unit tests.

Rules

Pattern: clean: Cleans the output files of a task.
Pattern: build: Assembles the artifacts of a configuration.
Pattern: upload: Assembles and uploads the artifacts belonging to a configuration.

To see all tasks and more detail, run gradle tasks --all

To see more detail about a task, run gradle help --task

BUILD SUCCESSFUL

Total time: 2.725 secs

This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.10/userguide/gradle_daemon.html


can you plaese let me know if i have to add any parameter in my build.gradle to get “shadowjar” task under my root project.

Thanks in advance.

The shadowJar task is from the third-party Shadow plugin. It is not part of the Gradle core. You would need to apply this plugin.

See:
Shadow Plugin on the Gradle Plugin Portal
Shadow Plugin User Guide

Hi james,

Thanks for your help.

Now I have downloaded a project for configuring web UI for prestodb.

when i am traying to run “gradle tasks or ./gradlew tasks” below error is showing

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘/opt/gradle/gradle-4.4.1/airpal/build.gradle’ line: 48

  • What went wrong:
    A problem occurred evaluating root project ‘airpal’.

Cannot cast object ‘[configuration ‘:provided’]’ with class ‘java.util.ArrayList’ to class ‘org.gradle.api.file.FileCollection’ due to: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: org.gradle.api.file.FileCollection(org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated)

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

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

Please help to get this resolved. Also if you have any other suggestion for configuring Web UI on Presto, let me know.