Gradle receives unexpected token, compiles files

What am I doing wrong? I mean this

build.gradle

compile files('libs/redisson-1.3.2-SNAPSHOT.jar')

ls libs /

$ ls libs/
redisson-1.3.2-SNAPSHOT.jar

Error

* Where:
Build file '/myfolder/myproject/build.gradle' line: 162

* What went wrong:
Could not compile build file '/myfolder/myproject/build.gradle'.
> startup failed:
  build file '/myfolder/myproject/build.gradle': 162: unexpected token: redisson @ line 162, column 23.
            compile files('libs/redisson-1.3.2-SNAPSHOT.jar')
                           ^

  1 error


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1.942 secs
+1
source share
1 answer

I have the same problem and fixed it.

Cause. This issue occurs due to an unresolved dependency in the build.gradle file. Below it will be seen that: Example. I gave json-simple a dependency in the build.gradle file, which will result in a build error on the next line. 1.

compilation ("com.googlecode.json-simple: JSON-simple: 1.1"
  compilation ("org.springframework.boot: spring-boot-starter-parent: $ {springBootVersion}")

build result:

  • : 'C:\Users\singha\Documents\GitHub\c-\build.gradle' : 52

    • : "C:\Users\singha\Documents\GitHub\collation-services\build.gradle".

      :   build file 'C:\Users\singha\Documents\GitHub\collation-services\build.gradle':   52: : @ 52, 4.          ( "org.springframework.boot: spring -boot--: ${springBootVersion}" )

compile ( "com.googlecode.json-simple: json-simple: 1.1" ( '/Google-HTTP--1.18.0-rc.jar')

:

  • : "C:\Users\singha\Documents\GitHub\collation-services\build.gradle".

    : 'C:\Users\singha\Documents\GitHub\collation-services\build.gradle':   68: : @ 68, 2.      ('libs/google-http-client-1.18.0-rc.jar')

: , , . 161 .

, , .

+2

Source: https://habr.com/ru/post/1652460/


All Articles