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

java not found error even when not using gradle command #170

Closed
EranClientside opened this issue Feb 28, 2023 · 5 comments
Closed

java not found error even when not using gradle command #170

EranClientside opened this issue Feb 28, 2023 · 5 comments

Comments

@EranClientside
Copy link

I'm using trapeze in my Bitbucket Pipeline and Appflow. It worked as expected for a few months but after upgrading from 6.0.10 to 7.0.8 it failed most of the time in the Pipeline because of the following error:

Fatal error: Error running command
Error: java not found on path and JAVA_HOME not set. Please set JAVA_HOME to the root of your Java installation.
Gradle parse functionality depends on a local Java install for accurate Gradle file modification.
    at GradleFile.parse (/opt/atlassian/pipelines/agent/build/node_modules/@trapezedev/project/dist/android/gradle-file.js:196:19)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async GradleFile.replaceProperties (/opt/atlassian/pipelines/agent/build/node_modules/@trapezedev/project/dist/android/gradle-file.js:53:9)
    at async executeOperations (/opt/atlassian/pipelines/agent/build/node_modules/@trapezedev/configure/dist/tasks/run.js:52:10)
    at async runCommand (/opt/atlassian/pipelines/agent/build/node_modules/@trapezedev/configure/dist/tasks/run.js:31:9)
    at async /opt/atlassian/pipelines/agent/build/node_modules/@trapezedev/configure/dist/index.js:58:13
    at async Command.<anonymous> (/opt/atlassian/pipelines/agent/build/node_modules/@trapezedev/configure/dist/util/cli.js:31:13)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I'm using node:14 image and didn't know I must have Java before the upgrade.
I tested every single release since 6.0.10 and this issue started in the version 6.0.12.

@mlynch
Copy link
Contributor

mlynch commented Mar 1, 2023

You'll need Java to run Android tasks, do you have it installed?

@EranClientside
Copy link
Author

EranClientside commented Mar 1, 2023

Is that now required for all of the Android commands?
As I mentioned above, our trapeze configuration worked without Java until v6.0.10.

@mlynch
Copy link
Contributor

mlynch commented Mar 1, 2023

Yes, it has been since the beginning pretty much. It's possible something else was masking it. Java is required for many of the Gradle operations for Android and many of the Android operations ultimately need to make Gradle modifications

@EranClientside
Copy link
Author

Well, the following ymls worked without it 🤷‍♂️

vars:
  npm_package_version:

platforms:
  ios:
    version: $npm_package_version
  android:
    versionName: $npm_package_version
    incrementVersionCode: true

project:
  json:
    - file: src-capacitor/package.json
      set:
        version: $npm_package_version
vars:
  npm_package_version:
    default: 1

  CI_BUILD_NUMBER:
    default: 1

platforms:
  android:
    versionName: $npm_package_version
    versionCode: $CI_BUILD_NUMBER
    copy:
      - src: ../../trapeze/firebase/google-services-testing.json
        dest: app/google-services.json
      - src: ../../trapeze/icons/android
        dest: ../android
    xml:
      - resFile: values/strings.xml
        target: resources/string[@name="onesignal_notification_accent_color"]
        replace: |
          <string name="onesignal_notification_accent_color">FFFFB738</string>
  ios:
    version: $npm_package_version
    buildNumber: $CI_BUILD_NUMBER
    copy:
      - src: ../../../trapeze/firebase/GoogleService-Info-testing.plist
        dest: App/GoogleService-Info.plist
      - src: ../../../trapeze/icons/ios
        dest: ../../ios

@mlynch
Copy link
Contributor

mlynch commented Mar 1, 2023

There have been a lot of changes and some of the Android operations may have moved to using the Gradle parser (which requires Java) to be more accurate. I don't recommend using older versions of Trapeze as a lot has changed. Make sure any build runners you have have Java installed.

@mlynch mlynch closed this as completed Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants