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

code.quarkus.io: gradle native build fails #45073

Open
Karm opened this issue Dec 11, 2024 · 4 comments
Open

code.quarkus.io: gradle native build fails #45073

Karm opened this issue Dec 11, 2024 · 4 comments
Labels
area/gradle Gradle area/native-image env/windows Impacts Windows machines kind/bug Something isn't working

Comments

@Karm
Copy link
Member

Karm commented Dec 11, 2024

Describe the bug

Hello,

I wanted to use the https://code.quarkus.io/ service to build a Quarkus native image on Windows, using Linux container builder image . I don't know much about Gradle, so I used the README, to no avail.

Expected behavior

It works.

Actual behavior

It doesn't work.

How to Reproduce?

Gradle 🔴

C:\tmp
λ powershell -Command "Invoke-WebRequest -Uri 'https://code.quarkus.io/d?e=rest&b=GRADLE&cn=code.quarkus.io' -OutFile 'code-with-quarkus.zip'"

C:\tmp
λ powershell -c "Expand-Archive -Path code-with-quarkus.zip -DestinationPath . -Force"

C:\tmp
λ cd code-with-quarkus

C:\tmp\code-with-quarkus
λ gradlew build -Dquarkus.native.enabled=true -Dquarkus.native.container-build=true
Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':quarkusBuild'.
> Outputting both native and JAR packages is not currently supported

* 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 50s

Maven 🟢

powershell -Command "Invoke-WebRequest -Uri 'https://code.quarkus.io/d?e=rest&b=MAVEN&cn=code.quarkus.io' -OutFile 'code-with-quarkus.zip'"
powershell -c "Expand-Archive -Path code-with-quarkus.zip -DestinationPath . -Force"
cd code-with-quarkus
mvnw package -Pnative -Dquarkus.native.container-build=true
...
Finished generating 'code-with-quarkus-1.0.0-SNAPSHOT-runner' in 2m 34s.

Output of uname -a or ver

Windows 10 Enterprise

Output of java -version

Temurin 21

Quarkus version or git rev

3.17.4

Build tool (ie. output of mvnw --version or gradlew --version)

gradle

Additional information

No response

@Karm Karm added the kind/bug Something isn't working label Dec 11, 2024
@quarkus-bot quarkus-bot bot added area/gradle Gradle area/native-image env/windows Impacts Windows machines labels Dec 11, 2024
Copy link

quarkus-bot bot commented Dec 11, 2024

/cc @glefloch, @quarkusio/devtools, @zakkak (native-image)

@maxandersen
Copy link
Member

are you getting different result on linux?

@Karm
Copy link
Member Author

Karm commented Dec 12, 2024

@maxandersen nope

$ curl -OJL 'https://code.quarkus.io/d?e=rest&cn=code.quarkus.io&b=GRADLE'
$ unzip code-with-quarkus.zip 
$ cd code-with-quarkus/
$ cat README.md  | grep native
$ ./gradlew build -Dquarkus.native.enabled=true -Dquarkus.native.container-build=true
Downloading https://services.gradle.org/distributions/gradle-8.9-bin.zip
............10%.............20%.............30%.............40%.............50%.............60%.............70%.............80%.............90%.............100%
Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':quarkusBuild'.
> Outputting both native and JAR packages is not currently supported

* 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 21s

No idea if the README is broken or the Gradle integration is broken.

@Karm Karm changed the title Gradle: native image build fails, Windows code.quarkus.io: gradle native build fails Dec 12, 2024
@gsmet
Copy link
Member

gsmet commented Dec 17, 2024

Yeah, we have an issue. Either with the README or with the code. And I think expecting people to use -Dquarkus.native.enabled=true -Dquarkus.package.jar.enabled=false to enable native is a bit too much.

The problem is due to these lines: https://github.com/quarkusio/quarkus/blob/main/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuild.java#L104-L106 .

From what I can see, we are not enforcing this in the Maven plugin. I think we had to at some point but maybe we relaxed things there and forgot to do it in the Gradle plugin?

@dmlloyd AFAICS, you added this check, is it still needed? (we are not setting quarkus.package.jar.enabled to false in the Maven projects AFAICS).

Note that when using the CLI, we are passing -Dquarkus.package.jar.enabled=false to the Gradle runner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gradle Gradle area/native-image env/windows Impacts Windows machines kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants