0

I have a gradle.build file https://github.com/JetBrains/java-annotations with

project(':java5').archivesBaseName = 'annotations-java5'

line and I have a error there:

* What went wrong:
A problem occurred evaluating root project 'java-annotations'.
> Project with path ':java5' could not be found in root project 'java-annotations'.

I have no idea what is "project" keyword syntax, could you point me to the proper documentation? Could you tell me what went wrong during "gradle build"?

Thank you!

  • The contents in a `build.gradle` file are not really keywords, they all map to properties or methods in the Gradle API or plugins running in the JVM. – Lukas Körfer Jun 18 '21 at 18:03

1 Answers1

0

The project method locates a project by path, which in this case is java5 relative to the root project (indicated by the leading :). As seen in the javadoc this method returns another Project instance, and here its archiveBaseName property is accessed.

F0X
  • 370
  • 4
  • 13
  • But I have "java5" directory inside! why it can't be found? – Ekaterina Ivanova iceja.net Jun 18 '21 at 18:04
  • @EkaterinaIvanovaiceja.net how are you running the gradle task? you are of course right, the `java5` project exists (see `settings.gradle`) – F0X Jun 18 '21 at 18:07
  • @EkaterinaIvanovaiceja.net that may be the problem, you should use the gradle wrapper via `./gradlew` to make sure the right version is used – F0X Jun 18 '21 at 20:07
  • @FOX after the fix described here https://stackoverflow.com/a/54359875/1999752 the ./gradlew command fails with same error message "Project with path ':java5' could not be found in root project 'java-annotations'. " – Ekaterina Ivanova iceja.net Jun 18 '21 at 20:27
  • @EkaterinaIvanovaiceja.net thats very very weird as the project clearly exists, if you are sure that you are in the right directory and everything else is correct, then maybe try deleting the `build` and `.gradle` caches, sometimes gradle does stupid stuff and magically stops after some cache clearing. – F0X Jun 18 '21 at 20:37
  • @FOX nothing helps. Same error – Ekaterina Ivanova iceja.net Jun 18 '21 at 20:42
  • 1
    @EkaterinaIvanovaiceja.net I really don't know what you are doing wrong, I just cloned the repo and it built successfully (openjdk 11, `JDK_5` = openjdk 8). The only requirement was setting the `JDK_5` env var. – F0X Jun 18 '21 at 20:51
  • @FOX I am sorry, gradle.settings was damaged, this question was created by mistake – Ekaterina Ivanova iceja.net Jun 21 '21 at 13:19