Stylianos Gakis
12/01/2023, 10:42 PMfun main
of a specific file?
Generating a run.json file, autocompletion could get me as far as this
{
"configurations": [
{
"type": "gradle",
"name": "Run 01",
"tasks": [],
},
]
}
But it doesn’t help further than that. When doing this in a gradle.kts file we’d specify the class name in there, but what should one do in this scenario? Should this be some configuration in amper, or something inside Fleet’s run.json?maiatoday
12/02/2023, 6:35 AMmaiatoday
12/02/2023, 6:36 AM{
"configurations": [
{
"type": "gradle",
"name": "Run main",
"tasks": [
"run"
],
},
]
}
maiatoday
12/02/2023, 6:36 AM./gradlew run
works in my projectmaiatoday
12/02/2023, 6:37 AMStylianos Gakis
12/02/2023, 7:06 AMfun main
called?maiatoday
12/02/2023, 7:16 AMfun main
does it not work for you if I type ./gradlew help --task run
it says the `run task will run the project as a jvm application. The plugin controls this I believe but I see the link you shared isn't the amper project templatezsmb
12/02/2023, 9:27 AMmain
function, you can copy that config and then paste it into the run.json
(this will be even simpler in upcoming Fleet releases):zsmb
12/02/2023, 9:28 AMDay1.kt
file for example:
{
"name": "Day01",
"type": "gradle",
"workingDir": "$PROJECT_DIR$",
"tasks": [
"jvmRun"
],
"args": [
"-DmainClass=Day01Kt",
"--quiet"
],
"initScripts": {
"flmapper": "ext.mapPath = { path -> null }"
}
}
You can see that the mainClass
is passed in as an argument, so that you know which main
function will be executed.Stylianos Gakis
12/03/2023, 11:52 AMCopy Configuration
is interesting, I did completely miss that myself!
Yeah I don’t think I would’ve figured this out myself, I would in any case have to open intellij to get the gutter action and go from there.
In fleet, I only got autocompletion in there for “gradle” in type, all the rest, even $PROJECT_DIR$ there was no autocompletion, so I guess the best bet is to copy as you show.
Good to note that when I click on “Copy configuration” I get nothing on my clipboard surprisingly, so I haven’t gotten that part to work for me.
Despite all this, after copying your configuration it now works properly when I run the Fleet configuration.
But when gradle tries to sync, it just errors out with a long stacktrace (attached later) which means that Fleet now does not offer me auto-completion help in the code itself. Since gradle sync fails. And I made sure my setup looks exactly like it does here btw https://github.com/zsmb13/advent-of-code-2023. Oh well, back to IntelliJ I think it is, I haven’t gotten this to work for me for the past few days 😄Stylianos Gakis
12/03/2023, 11:52 AMzsmb
12/03/2023, 11:59 AM