Gradle gets unexpected token, compile files

后端 未结 1 1418
孤独总比滥情好
孤独总比滥情好 2020-12-20 00:43

What am I doing wrong ? I am referring to this

build.gradle

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

相关标签:
1条回答
  • 2020-12-20 01:36

    I got the same issue and fixed it.

    Cause: This issue comes because of unresolved dependency in build.gradle file. It would be more clear by below example: Example: I have given a json-simple dependency in build.gradle file which will result in build error at next line. 1.

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

    build result:

    • Where: Build file 'C:\Users\singha\Documents\GitHub\coalition-services\build.gradle' line: 52

      • What went wrong: Could not compile build file 'C:\Users\singha\Documents\GitHub\coalition-services\build.gradle'.

        startup failed: build file 'C:\Users\singha\Documents\GitHub\coalition-services\build.gradle': 52: unexpected token: compile @ line 52, column 4. compile("org.springframework.boot:spring-boot-starter-parent:${springBootVersion}")

    1. Tried putting the same unresolved dependency at diffrent place in build file

    compile("com.googlecode.json-simple:json-simple:1.1" compile files('libs/google-http-client-1.18.0-rc.jar')

    result:

    • What went wrong: Could not compile build file 'C:\Users\singha\Documents\GitHub\coalition-services\build.gradle'.

      startup failed: build file 'C:\Users\singha\Documents\GitHub\coalition-services\build.gradle': 68: unexpected token: compile @ line 68, column 2. compile files('libs/google-http-client-1.18.0-rc.jar')

    Solution: Just delete the previous line where the given error is coming as that could be causing the issue. In your case, try deleting the 161 line or previous line of dependency given.

    Please let me know if it resolved the problem.

    0 讨论(0)
提交回复
热议问题