If you have multiple main classes, you'd create a task like this for each
of them and then run a task as needed:

task(runSimple, dependsOn: 'classes', type: JavaExec) {
    main = 'com.mrhaki.java.Simple'
    classpath = sourceSets.main.runtimeClasspath
    args 'mrhaki'
    systemProperty 'simple.message', 'Hello '
}

https://mrhaki.blogspot.com/2010/09/gradle-goodness-run-java-application.html

I.e., in the above, you have a class named Simple, with a main method, and
so you'd run the 'runSimple' task above to run that main class.

And then you'd created another task just like that for each of your other
main classes.

Does that help? It works for me.

Gj

On Wed, Jul 10, 2019 at 9:59 PM Geertjan Wielenga <geert...@apache.org>
wrote:

> If you can provide a small project on GitHub that has the kind of set up
> that you need help with, I can try to help.
>
> Gj
>
> On Wed, Jul 10, 2019 at 9:52 PM Mike Billman <mikebill...@qcsoftware.com>
> wrote:
>
>> Is there an equivalent to the “run configurations” available in
>> eclipse/intellij?
>>
>>
>>
>> Mike
>>
>>
>>
>> *From:* Mike Billman <mikebill...@qcsoftware.com>
>> *Sent:* Wednesday, July 10, 2019 3:43 PM
>> *To:* Laszlo Kishalmi <laszlo.kisha...@gmail.com>;
>> users@netbeans.apache.org
>> *Subject:* RE: NB11 - gradle support
>>
>>
>>
>> I was able to get this far…
>>
>>
>>
>> task autoPickInterface(type:Exec) {
>>
>>   standardOutput System.out
>>
>>   standardInput System.in
>>
>>   commandLine 'cmd', '/v', '/c', '"choices.bat -j 11x64 -s 17x64 &
>> sandbox & run-profile creekstone & java
>> Products.HostInterface.HostInterface -r -n autoPickInterface -l"'
>>
>> }
>>
>>
>>
>> However, I cannot type input into the output window.  I can’t help but
>> think there is something I just don’t understand…I tried this:
>>
>>
>>
>> task runApp(type: JavaExec) {
>>
>>   classpath = sourceSets.main.runtimeClasspath
>>
>>   main = 'Products.HostInterface.HostInterface'
>>
>>   args '-r -n autoPickInterface -l'
>>
>> }
>>
>>
>>
>> And I get an enormous classpath…
>>
>>
>>
>> Mike
>>
>>
>>
>> *From:* Laszlo Kishalmi <laszlo.kisha...@gmail.com>
>> *Sent:* Tuesday, July 2, 2019 5:18 PM
>> *To:* users@netbeans.apache.org
>> *Subject:* Re: NB11 - gradle support
>>
>>
>>
>> The best way to do it to add Gradle tasks in your build.grade for each
>> main class (like runApp1, runApp2).
>>
>> Then open the project properties and configure custom actions for each
>> application.
>>
>> Or you might reconfigure run and debug actions to use:
>>
>> run${input:Application}
>>
>> or
>>
>> run${input:Application,DefaultApp}
>>
>> This way you would be prompted for the application to run/debug.
>>
>>
>>
>> On 7/2/19 12:06 PM, Mike Billman wrote:
>>
>> Our gradle project isn’t set up with run configured because we run
>> multiple applications out of the same project (different main classes).
>> Just wondering the best way to set this up…custom tasks?
>>
>>
>>
>> Thanks.
>>
>>
>>
>> Mike
>>
>>
>>
>> *From:* Geertjan Wielenga <geert...@apache.org> <geert...@apache.org>
>> *Sent:* Tuesday, July 2, 2019 3:02 PM
>> *To:* Mike Billman <mikebill...@qcsoftware.com>
>> <mikebill...@qcsoftware.com>
>> *Cc:* users@netbeans.apache.org
>> *Subject:* Re: NB11 - gradle support
>>
>>
>>
>> Open the project and click Run.
>>
>>
>>
>> If the above doesn't work, what's the problem exactly so that we can help
>> with the problem you're encountering?
>>
>>
>>
>> Gj
>>
>>
>>
>> On Tue, Jul 2, 2019 at 9:00 PM Mike Billman <mikebill...@qcsoftware.com>
>> wrote:
>>
>> Hey –
>>
>>
>>
>> I was wondering if there are any tutorials on using the new gradle
>> support introduced in 11.0.  I would like to try to figure out how to run
>> my applications, but am not sure how.
>>
>>
>>
>> Thanks!
>>
>>
>>
>> Mike Billman
>>
>> Senior Software Engineer
>>
>> CPTE
>>
>>
>>
>> [image: qclogo]
>>
>>
>>
>> 50 E-Business Way
>>
>> Suite 300
>>
>> Cincinnati, OH 45241
>>
>>
>>
>> T +1 513 469 1424
>>
>> E mikebill...@qcsoftware.com
>>
>> F +1 513 469 1425
>>
>>
>>
>>

Reply via email to