Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] When npx projen build: Task "build » compile » generate" failed when executing "./gradlew build" #778

Closed
teddyaryono opened this issue May 6, 2024 · 5 comments
Labels
bug Something isn't working needs-triage stale

Comments

@teddyaryono
Copy link

teddyaryono commented May 6, 2024

Describe the bug

Went through the getting started guide, and ran into this issue.

$ npx projen build

👾 build | pnpm exec nx run-many --target=build --output-style=stream --nx-bail

 >  NX   Running target build for 7 projects:

    - myapi-typescript-react-query-hooks
    - myapi-typescript-infra
    - myapi-documentation-html-redoc
    - myapi-typescript-runtime
    - myapi-typescript-handlers
    - myapi-model
    - myapi

 ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

> nx run myapi-model:build


> nx run myapi:build  [local cache]

myapi-model: 👾 build » compile » generate | npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.copy-gradle-wrapper
myapi-model: Copying Gradle Wrapper...
myapi-model: Copied Gradle Wrapper
myapi-model: 👾 build » compile » generate | ./gradlew build
myapi-model: FAILURE: Build failed with an exception.
myapi-model: * What went wrong:
myapi-model: Could not open settings generic class cache for settings file '/Users/taryono/Code/projects/prototyping-sandbox/my-project/packages/api/model/settings.gradle' (/Users/taryono/.gradle/caches/8.3/scripts/8ye291m6tu88vf0jb5v7qjixz).
myapi-model: > BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 66
myapi-model: * Try:
myapi-model: > Run with --stacktrace option to get the stack trace.
myapi-model: > Run with --info or --debug option to get more log output.
myapi-model: > Run with --scan to get full insights.
myapi-model: > Get more help at https://help.gradle.org.
myapi-model: BUILD FAILED in 308ms
myapi-model: 👾 Task "build » compile » generate" failed when executing "./gradlew build" (cwd: /Users/taryono/Code/projects/prototyping-sandbox/my-project/packages/api/model)
myapi-model: Warning: run-commands command "pnpm dlx projen build" exited with non-zero status code

 ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Running target build for 7 projects failed

   Tasks not run because their dependencies failed or --nx-bail=true:
   
   - myapi-typescript-react-query-hooks:build
   - myapi-typescript-infra:build
   - myapi-documentation-html-redoc:build
   - myapi-typescript-runtime:build
   - myapi-typescript-handlers:build
   
   Failed tasks:
   
   - myapi-model:build

👾 Task "build" failed when executing "pnpm exec nx run-many --target=build --output-style=stream --nx-bail" (cwd: /Users/taryono/Code/projects/prototyping-sandbox/my-project)

Expected Behavior

Project built successfully.

Current Behavior

👾 Task "build » compile » generate" failed when executing "./gradlew build" (cwd: /Users/taryono/Code/projects/prototyping-sandbox/my-project/packages/api/model)

Reproduction Steps

  1. npx projen new --from @aws/pdk --package-manager=pnpm monorepo-ts
  2. npx projen
  3. npx projen build
  4. Add a Type-Safe API to .projenrc.ts
  5. npx projen
  6. npx projen build
  7. Described error happened

Possible Solution

No response

Additional Information/Context

Java and maven version:

$ java --version
openjdk 22.0.1 2024-04-16
OpenJDK Runtime Environment Corretto-22.0.1.8.1 (build 22.0.1+8-FR)
OpenJDK 64-Bit Server VM Corretto-22.0.1.8.1 (build 22.0.1+8-FR, mixed mode, sharing)

$ mvn --version
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: /Users/taryono/apache-maven-3.9.6
Java version: 22.0.1, vendor: Amazon.com Inc., runtime: /Library/Java/JavaVirtualMachines/amazon-corretto-22.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "14.4.1", arch: "aarch64", family: "mac"

PDK version used

0.23.37

What languages are you seeing this issue on?

Typescript

Environment details (OS name and version, etc.)

Apple M1 Pro, MacOS Sonoma 14.4.1

@teddyaryono teddyaryono added bug Something isn't working needs-triage labels May 6, 2024
@Funkmyster
Copy link

I'm getting the same error when building the Python version

Here's my Java info from inside the generated project

cd packages/api/model
./gradlew --version

------------------------------------------------------------
Gradle 8.3
------------------------------------------------------------

Build time:   2023-08-17 07:06:47 UTC
Revision:     8afbf24b469158b714b36e84c6f4d4976c86fcd5

Kotlin:       1.9.0
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          22.0.1 (Amazon.com Inc. 22.0.1+8-FR)
OS:           Mac OS X 14.4.1 x86_64

@Funkmyster
Copy link

Hey @teddyaryono! I got a fix

Apparently Gradle 8.3 is not compatalble with our Java Corretto 22
https://docs.gradle.org/current/userguide/compatibility.html#compatibility

I just set my JAVA_HOME to a openjdk20

export JAVA_HOME=/usr/local/opt/openjdk@20/
npx projen
npx projen build

@teddyaryono
Copy link
Author

Thanks @Funkmyster - I got mine fixed by downgrading to Corretto 17.

Copy link

This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon. If you wish to exclude this issue from being marked as stale, add the "backlog" label.

@github-actions github-actions bot added the stale label Jul 15, 2024
Copy link

Closing this issue as it hasn't seen activity for a while. Please add a comment @mentioning a maintainer to reopen. If you wish to exclude this issue from being marked as stale, add the "backlog" label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage stale
Projects
None yet
Development

No branches or pull requests

2 participants