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

Fix gradlew commands on Windows #77

Closed
mic-max opened this issue Jun 1, 2022 · 22 comments · Fixed by #363
Closed

Fix gradlew commands on Windows #77

mic-max opened this issue Jun 1, 2022 · 22 comments · Fixed by #363
Assignees
Labels
bug Something isn't working

Comments

@mic-max
Copy link
Contributor

mic-max commented Jun 1, 2022

The adservice fails to build at the RUN ./gradlew downloadRepos step

You must run

  • ./gradlew installDist from /src/adservice/
  • ./gradlew wrapper --gradle-version 7.4.2

Maybe only one of the above commands is necessary...

Then the following command should work:
docker compose build cartservice

Proposed Fix:

Make the docker compose up the only required command to run the whole project, so this might be simply upgrading the jar file: /src/adservice/gradle/wrapper/gradle-wrapper.jar to the 7.4.2 version done in the command found above.

image
The other changes to /src/adservice/gradle/wrapper/gradle-wrapper.properties and /src/adservice/gradlew are only related to line endings:
image

@mic-max mic-max added the bug Something isn't working label Jun 1, 2022
@mic-max mic-max self-assigned this Jun 1, 2022
@cijothomas
Copy link
Member

I am still unable to run from windows. The instruction from https://github.com/open-telemetry/opentelemetry-demo-webstore#gradle-update-windows-only also does not help.

C:\repos\opentelemetry-demo-webstore\src\adservice>.\gradlew installDist

> Task :compileJava FAILED
C:\repos\opentelemetry-demo-webstore\src\adservice\src\main\java\hipstershop\AdService.java:21: error: package hipstershop.Demo does not exist
import hipstershop.Demo.Ad;
                       ^
C:\repos\opentelemetry-demo-webstore\src\adservice\src\main\java\hipstershop\AdService.java:22: error: package hipstershop.Demo does not exist
import hipstershop.Demo.AdRequest;
                       ^
C:\repos\opentelemetry-demo-webstore\src\adservice\src\main\java\hipstershop\AdService.java:23: error: package hipstershop.Demo does not exist
import hipstershop.Demo.AdResponse;
                       ^
C:\repos\opentelemetry-demo-webstore\src\adservice\src\main\java\hipstershop\AdService.java:137: error: cannot find symbol
  private static final ImmutableListMultimap<String, Ad> adsMap = createAdsMap();
                                                     ^
  symbol:   class Ad
  location: class AdService
C:\repos\opentelemetry-demo-webstore\src\adservice\src\main\java\hipstershop\AdService.java:140: error: cannot find symbol
  private Collection<Ad> getAdsByCategory(@SpanAttribute("app.ads.category") String category) {

@mic-max
Copy link
Contributor Author

mic-max commented Jul 6, 2022

@cijothomas Does running docker compose build --no-cache adservice work?
If so, I think we can close and remove the instruction from README.md - the merged PR linked to this issue might have fixed the entire issue and the extra steps are no longer needed.

@cijothomas
Copy link
Member

image
unfortunately, no :(

@cartersocha
Copy link
Contributor

Seems to potentially be an issue between mac & windows ending characters for the gradlew file. I fixed it by changing the ending character in notepad++ to Unix lf

@cartersocha
Copy link
Contributor

Has this been fixed @mic-max? I know we have the readme windows guidance

@mic-max
Copy link
Contributor Author

mic-max commented Jul 25, 2022

Has this been fixed @mic-max? I know we have the readme windows guidance

I'm not sure, I haven't done any related change recently since I'm not able to reproduce the problem anymore..

@cijothomas
Copy link
Member

https://github.com/open-telemetry/opentelemetry-demo#gradle-update-windows-only This section does not work in windows.

pasting few lines from the error I see:

C:\repos\opentelemetry-demo\src\adservice>.\gradlew installDist
Starting a Gradle Daemon (subsequent builds will be faster)

Task :compileJava
C:\repos\opentelemetry-demo\src\adservice\src\main\java\hipstershop\AdService.java:21: error: package hipstershop.Demo does not exist
import hipstershop.Demo.Ad;
^
C:\repos\opentelemetry-demo\src\adservice\src\main\java\hipstershop\AdService.java:22: error: package hipstershop.Demo does not exist
import hipstershop.Demo.AdRequest;
^
C:\repos\opentelemetry-demo\src\adservice\src\main\java\hipstershop\AdService.java:23: error: package hipstershop.Demo does not exist
import hipstershop.Demo.AdResponse;
^
C:\repos\opentelemetry-demo\src\adservice\src\main\java\hipstershop\AdService.java:137: error: cannot find symbol
private static final ImmutableListMultimap<String, Ad> adsMap = createAdsMap();
^
symbol: class Ad
location: class AdService
C:\repos\opentelemetry-demo\src\adservice\src\main\java\hipstershop\AdService.java:140: error: cannot find symbol
private Collection getAdsByCategory(@SpanAttribute("app.ads.category") String category) {
^
symbol: class Ad
location: class AdService
C:\repos\opentelemetry-demo\src\adservice\src\main\java\h

@cijothomas
Copy link
Member

Since the issue is not fixed, I'd suggest to keep this open.

@cartersocha
Copy link
Contributor

Did you try changing the file ending @cijothomas ? I’m unable to reproduce

@cijothomas
Copy link
Member

Did you try changing the file ending @cijothomas ?

No

@echuang81
Copy link

Hi expert, I have the same issue when building the adservice from Windows.if changing ending character can solve the problem, which gradle file is related to do ? I can help to test

@cartersocha
Copy link
Contributor

@echuang81 check out the last comment on this stackoverflow post. It worked for me. https://stackoverflow.com/questions/70844518/cant-run-gradle-wrapper-with-docker-build

@cartersocha cartersocha reopened this Aug 2, 2022
@cartersocha
Copy link
Contributor

@echuang81
Copy link

Hi @cartersocha, thanks for your guidance. I tried re-clone with configuration autocrlf input set, as well as converting EOL to LF only character. Unfortunately, both also not working. hmm......

@joshleecreates
Copy link
Contributor

What is the state of this issue? I'm receiving the same error as @cijothomas while building in a clean ubuntu vm.

@cartersocha
Copy link
Contributor

I've solved this multiple times on my surface windows 11 by following these instructions. Not sure what others are encountering. I believe it's the file ending character causing problems but unsure how to fix for all or if that's the only problem.

I clone the repo, run docker compose build, it fails, change the gradlew that has no file ending by following below steps, then run docker compose build again & it works. 🤷‍♂️ @mic-max, @puckpuck

"Converting EOL to UNIX (LF) of the gradlew file should work. It can be fixed using notepad++.

Open the gradlew file in notepad++

Edit -> EOL Conversion -> UNIX (LF)

save"

@cartersocha
Copy link
Contributor

We discussed this in the sig meeting today.

Was the resolution adding a comment to the gradlew file or EOF character or something else? @puckpuck

@cartersocha
Copy link
Contributor

@echuang81 , @joshleecreates 90% chance it's a file ending issue. Please try this solution or this one and report if either works!

@cartersocha
Copy link
Contributor

@cijothomas
Copy link
Member

=> ERROR [ghcr.io/open-telemetry/demo:v0.3.4-adservice builder 6/7] RUN ./gradlew downloadRepos 0.9s
=> CANCELED [ghcr.io/open-telemetry/demo:v0.3.4-featureflagservice builder 1/18] FROM docker.io/hexpm/elixir:1.13.3-erlang-25.0-debian-bullseye-202 0.9s
=> => resolve docker.io/hexpm/elixir:1.13.3-erlang-25.0-debian-bullseye-20210902-slim@sha256:319af72370fdded0a0a7ea976c2d7a0d5c465b901ab0bb2b2440cb0 0.0s
=> => sha256:a1edbbb43e6863c79911a71177e71c9781bbffe20edfe14cb532a0f688490d33 2.33kB / 2.33kB 0.0s
=> => sha256:319af72370fdded0a0a7ea976c2d7a0d5c465b901ab0bb2b2440cb0f23f1b650 772B / 772B 0.0s
=> => sha256:ffc8fc0c5b925981f57363ef56effdc6e657e0d141fdcfbbb749c145fe394db9 1.16kB / 1.16kB 0.0s
=> [ghcr.io/open-telemetry/demo:v0.3.4-featureflagservice internal] load build context 0.1s
=> => transferring context: 5.09kB 0.0s
=> CANCELED [ghcr.io/open-telemetry/demo:v0.3.4-featureflagservice stage-1 1/6] FROM docker.io/library/debian:bullseye-20210902-slim@sha256:e3ed4be2 0.9s
=> => resolve docker.io/library/debian:bullseye-20210902-slim@sha256:e3ed4be20c22a1358020358331d177aa2860632f25b21681d79204ace20455a6 0.0s
=> => sha256:e3ed4be20c22a1358020358331d177aa2860632f25b21681d79204ace20455a6 1.85kB / 1.85kB 0.0s
=> => sha256:8aa2e47f9a6cf001ecf3ad0f8439e1005743a3024b98e7bbf023ace55afea903 529B / 529B 0.0s
=> => sha256:7beb0248fd8163ea6effdf58af3e836c47f2f97d7e44e5109c95333c92190a48 1.46kB / 1.46kB 0.0s
=> CACHED [ghcr.io/open-telemetry/demo:v0.3.4-frontend deps 2/5] RUN apk add --no-cache libc6-compat 0.0s
=> CACHED [ghcr.io/open-telemetry/demo:v0.3.4-frontend deps 3/5] WORKDIR /app 0.0s
=> CACHED [ghcr.io/open-telemetry/demo:v0.3.4-frontend deps 4/5] COPY ./src/frontend/package*.json ./ 0.0s
=> CANCELED [ghcr.io/open-telemetry/demo:v0.3.4-frontend deps 5/5] RUN npm ci 2.2s

[ghcr.io/open-telemetry/demo:v0.3.4-adservice builder 6/7] RUN ./gradlew downloadRepos:
#0 0.845 /bin/sh: 1: ./gradlew: not found


failed to solve: executor failed running [/bin/sh -c ./gradlew downloadRepos]: exit code: 127

This is still failing after following the latest instructions. Please reopen this.

@cijothomas
Copy link
Member

My bad. It does work with the newest instruction. I missed the part about "delete and re-clone the repo".

@cartersocha
Copy link
Contributor

My bad. It does work with the newest instruction. I missed the part about "delete and re-clone the repo".

All good :) glad we got this fully closed!

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

Successfully merging a pull request may close this issue.

5 participants