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

quarkus.args not work with gradle and quarkus 2.13.0 #28443

Closed
deblockt opened this issue Oct 7, 2022 · 11 comments · Fixed by #29250 · May be fixed by #31318
Closed

quarkus.args not work with gradle and quarkus 2.13.0 #28443

deblockt opened this issue Oct 7, 2022 · 11 comments · Fixed by #29250 · May be fixed by #31318
Labels
area/gradle Gradle kind/bug Something isn't working
Milestone

Comments

@deblockt
Copy link

deblockt commented Oct 7, 2022

Describe the bug

I try to write my own main like that:

@QuarkusMain
public class Main {
    public static void main(String... args) {
        System.out.println(args.length);
    }
}

And execute it using quarkus cli like that

quarkus dev --verbose -- param
or
quarkus dev --verbose -Dquarkus.args="param"

Expected behavior

The main is executed and display "1"

Actual behavior

The main is executed and display "0"

How to Reproduce?

No response

Output of uname -a or ver

Darwin --- 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64 x86_64 i386 MacBookPro16,1 Darwin

Output of java -version

1.17

GraalVM version (if different from Java)

2.13.0

Quarkus version or git rev

No response

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

7.4.2

Additional information

In verbose mode I can see that parameter is set on quarkus.args but seem not used:

gradlew --console=rich -DquarkusRegistryClient=true quarkusDev -Dquarkus.args='param' -Dio.quarkus.devmode-args=/var/folders/4q/z24jsww13cv73x6jqyqlj_880000gn/T/quarkus-dev2169293274555449898.txt

@deblockt deblockt added the kind/bug Something isn't working label Oct 7, 2022
@quarkus-bot quarkus-bot bot added the area/gradle Gradle label Oct 7, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Oct 7, 2022

/cc @glefloch, @quarkusio/devtools

@glefloch
Copy link
Member

glefloch commented Oct 7, 2022

Thanks for reporting this @deblockt I will have a look into it.

@geoand
Copy link
Contributor

geoand commented Oct 19, 2022

@glefloch any idea what's going on?

@glefloch
Copy link
Member

Yes I think we just don't forward system property from the gradle process to the quarkus dev process. It should be easy to fix

@jacobdotcosta
Copy link
Contributor

I can take a look at this issue, it seems to be an affordable first issue for me after reading @glefloch comments.

@glefloch
Copy link
Member

glefloch commented Nov 2, 2022

Yes you can, I gave it a try a week a go, but it wasn't as easy as I thought, I tried declaring gradle system properties to the quarkus process system properties but it had no effects :/

@jacobdotcosta
Copy link
Contributor

It isn't the affordable first issue I was expecting 😃 as I've made several tests and it seems that no project context is reaching the QuarkusDev task. I'll keep investigating.

@jacobdotcosta
Copy link
Contributor

Finally have it 🎉 !!! Will try creating a test case for this and prepare a PR.

@geoand
Copy link
Contributor

geoand commented Nov 10, 2022

Awesome, thanks!

@jacobdotcosta
Copy link
Contributor

I have a doubt regarding launching dev mode.

Launching with either ./gradlew quarkusDev -Dquarkus.args="param1=1 param2=2" or quarkus dev -Dquarkus.args="param1=1 param2=2" shows the same result in the main method which is an array of 2 parameters.

args: 2
[param1=1, param2=2]

Nevertheless launching dev mode using quarkus dev -- param1=1 param2=2 doesn't split the parameters into 2.

args: 1
[param1=1 param2=2]

The main code is the following:

    public static void main(String... args) {
        System.out.println("args: " + args.length);
        System.out.println(Arrays.toString(args));
    }

Is passing arguments in the form quarkus dev -- param1=1 param2=2 different?

@geoand
Copy link
Contributor

geoand commented Nov 10, 2022

I think -- is a shell thing that allows you pass an entire string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gradle Gradle kind/bug Something isn't working
Projects
None yet
4 participants