linkedin / rest.li

Rest.li is a REST+JSON framework for building robust, scalable service architectures using dynamic discovery and simple asynchronous APIs.
rest.li
Other
2.51k stars 546 forks source link

quickstart guide gradle build doesn't work #86

Open vshwnth2 opened 7 years ago

vshwnth2 commented 7 years ago

Trying to follow https://github.com/linkedin/rest.li/wiki/Quickstart:-A-Tutorial-Introduction-to-Rest.li

On the first gradle build command inside /api folder, i get the following error:

Task :api:generateDataTemplate FAILED [main] INFO com.linkedin.pegasus.generator.PegasusDataTemplateGenerator - Generating 1 files Exception in thread "main" java.io.IOException: /Users/maheshvishwanath/sante-restli/api/src/mainGeneratedDataTemplate/java: non-existent directory at com.sun.codemodel.writer.FileCodeWriter.(FileCodeWriter.java:73) at com.linkedin.pegasus.generator.PegasusDataTemplateGenerator.run(PegasusDataTemplateGenerator.java:152) at com.linkedin.pegasus.generator.PegasusDataTemplateGenerator.main(PegasusDataTemplateGenerator.java:105)

FAILURE: Build failed with an exception.

If it helps, these are the versions I have installed locally: gradle --version


Gradle 4.3.1

Build time: 2017-11-08 08:59:45 UTC Revision: e4f4804807ef7c2829da51877861ff06e07e006d

Groovy: 2.4.12 Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015 JVM: 1.8.0_121 (Oracle Corporation 25.121-b13) OS: Mac OS X 10.12.4 x86_64

vshwnth2 commented 7 years ago

stacktrace:

DongQuYiPiLang commented 6 years ago

should be the gradle version issue, if you use gradle 4.0, it will be fine, good luck!

evanw555 commented 5 years ago

@vshwnth2 This is quite a delayed follow-up, but this was resolved, yeah?

venkyvb commented 4 years ago

The quick-start seems to be broken again. When I go the /api folder and do a gradle build I see the following error:

FAILURE: Build failed with an exception.

* Where:
Build file '/rest.li-master/examples/quickstart/build.gradle' line: 12

* What went wrong:
A problem occurred evaluating root project 'quickstart'.
> Cannot add task 'wrapper' as a task with that name already exists.

* 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

BUILD FAILED in 436ms

When I change the following in the /rest.li-master/examples/quickstart/build.gradle

task wrapper(type: Wrapper) {
  gradleVersion = '4.6'
}

to

wrapper {
  gradleVersion = '4.6'
}

and then try gradle build in the /api folder I see the following error:

> Task :api:changedFilesReport FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':api:changedFilesReport'.
> You must declare outputs or use `TaskOutputs.upToDateWhen()` when using the incremental task API

* 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

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

BUILD FAILED in 637ms
6 actionable tasks: 1 executed, 5 up-to-date

any ideas as to what could be going wrong?

evanw555 commented 4 years ago

@venkyvb Yeah, my guess is that this is something we forgot to clean up when upgrading to Gradle 5. See how we removed the wrapper task for the root build script in linkedin#242. I'm inferring that the guy who did the work didn't try building these sample projects (people often forget they're there). Could you try removing the wrapper task definition altogether? If it works, feel free to open a PR to fix this.

liz2020 commented 3 years ago

@evanw555 I tried removing the wrapper task (line 12 - 14 in build.gradle) and it builds successfully. So, your suggestion works!

viju4u commented 2 years ago

Task :api:generateDataTemplate FAILED

FAILURE: Build failed with an exception.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.4.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 4s 1 actionable task: 1 executed

I am facing this issue when i tried to build in api gradle file //Content of build file in api folder api/build.gradle apply plugin: 'pegasus'