How to convert gradle ant java task to kotlin2019 Community Moderator ElectionHow do I efficiently iterate over each entry in a Java Map?How do I call one constructor from another in Java?How do I read / convert an InputStream into a String in Java?How do I generate random integers within a specific range in Java?How to get an enum value from a string value in Java?How do I determine whether an array contains a particular value in Java?How do I declare and initialize an array in Java?How to avoid Java code in JSP files?How to split a string in JavaHow do I convert a String to an int in Java?
What does it mean to make a bootable LiveUSB?
What is IP squat space
How to simplify this time periods definition interface?
Where is the 1/8 CR apprentice in Volo's Guide to Monsters?
Russian cases: A few examples, I'm really confused
How Did the Space Junk Stay in Orbit in Wall-E?
Meaning of "SEVERA INDEOVI VAS" from 3rd Century slab
Should we release the security issues we found in our product as CVE or we can just update those on weekly release notes?
Why must traveling waves have the same amplitude to form a standing wave?
Can the damage from a Talisman of Pure Good (or Ultimate Evil) be non-lethal?
How to make healing in an exploration game interesting
2D counterpart of std::array in C++17
How do I hide Chekhov's Gun?
Does the statement `int val = (++i > ++j) ? ++i : ++j;` invoke undefined behavior?
Fill color and outline color with the same value
Theorems like the Lovász Local Lemma?
Why do Australian milk farmers need to protest supermarkets' milk price?
How to generate globally unique ids for different tables of the same database?
Font with correct density?
Can hydraulic brake levers get hot when brakes overheat?
How to get the name of the database a stored procedure is executed in within that stored procedure while it's executing?
Do I need life insurance if I can cover my own funeral costs?
How to answer questions about my characters?
What is a good source for large tables on the properties of water?
How to convert gradle ant java task to kotlin
2019 Community Moderator ElectionHow do I efficiently iterate over each entry in a Java Map?How do I call one constructor from another in Java?How do I read / convert an InputStream into a String in Java?How do I generate random integers within a specific range in Java?How to get an enum value from a string value in Java?How do I determine whether an array contains a particular value in Java?How do I declare and initialize an array in Java?How to avoid Java code in JSP files?How to split a string in JavaHow do I convert a String to an int in Java?
I have a gradle ant task that starts a H2 database. The build script looks like this:
apply plugin: 'java'
repositories
mavenCentral()
dependencies
runtime 'com.h2database:h2:1.3.168'
task startH2Db
group = 'database'
description='Starts the H2 TCP database server on port 9092 and web admin on port 8082'
doLast
ant.java( fork:true, spawn:true, classname:'org.h2.tools.Server', dir:projectDir)
arg(value: "-tcp")
arg(value: "-web")
arg(value: "-tcpPort")
arg(value: "9092")
arg(value: "-webPort")
arg(value: "8082")
arg(value: "-webAllowOthers")
classpath
pathelement(path:"$sourceSets.main.runtimeClasspath.asPath")
Given that Gradle are now supporting Kotlin, I decided to try and convert this build.gradle into a build.gradle.ktsfile.
I'm struggling to find documentation on how to do this in Kotlin. I've found examples of other ant tasks, but nothing with args like above. I have got as far as this:
plugins
java
repositories
mavenCentral()
dependencies
runtime ("com.h2database:h2:1.3.168")
tasks
register("startH2Database")
group = "database"
description = "Starts the H2 TCP database server on port 9092 and web admin on port 8082"
doLast
ant.withGroovyBuilder
"java"("fork" to true, "spawn" to true, "classname" to "org.h2.tools.Server", "dir" to projectDir)
How do I configure the args and the classpath? Is there any extra documentation other than what's listed here: https://docs.gradle.org/current/userguide/ant.html?
java gradle kotlin ant
add a comment |
I have a gradle ant task that starts a H2 database. The build script looks like this:
apply plugin: 'java'
repositories
mavenCentral()
dependencies
runtime 'com.h2database:h2:1.3.168'
task startH2Db
group = 'database'
description='Starts the H2 TCP database server on port 9092 and web admin on port 8082'
doLast
ant.java( fork:true, spawn:true, classname:'org.h2.tools.Server', dir:projectDir)
arg(value: "-tcp")
arg(value: "-web")
arg(value: "-tcpPort")
arg(value: "9092")
arg(value: "-webPort")
arg(value: "8082")
arg(value: "-webAllowOthers")
classpath
pathelement(path:"$sourceSets.main.runtimeClasspath.asPath")
Given that Gradle are now supporting Kotlin, I decided to try and convert this build.gradle into a build.gradle.ktsfile.
I'm struggling to find documentation on how to do this in Kotlin. I've found examples of other ant tasks, but nothing with args like above. I have got as far as this:
plugins
java
repositories
mavenCentral()
dependencies
runtime ("com.h2database:h2:1.3.168")
tasks
register("startH2Database")
group = "database"
description = "Starts the H2 TCP database server on port 9092 and web admin on port 8082"
doLast
ant.withGroovyBuilder
"java"("fork" to true, "spawn" to true, "classname" to "org.h2.tools.Server", "dir" to projectDir)
How do I configure the args and the classpath? Is there any extra documentation other than what's listed here: https://docs.gradle.org/current/userguide/ant.html?
java gradle kotlin ant
add a comment |
I have a gradle ant task that starts a H2 database. The build script looks like this:
apply plugin: 'java'
repositories
mavenCentral()
dependencies
runtime 'com.h2database:h2:1.3.168'
task startH2Db
group = 'database'
description='Starts the H2 TCP database server on port 9092 and web admin on port 8082'
doLast
ant.java( fork:true, spawn:true, classname:'org.h2.tools.Server', dir:projectDir)
arg(value: "-tcp")
arg(value: "-web")
arg(value: "-tcpPort")
arg(value: "9092")
arg(value: "-webPort")
arg(value: "8082")
arg(value: "-webAllowOthers")
classpath
pathelement(path:"$sourceSets.main.runtimeClasspath.asPath")
Given that Gradle are now supporting Kotlin, I decided to try and convert this build.gradle into a build.gradle.ktsfile.
I'm struggling to find documentation on how to do this in Kotlin. I've found examples of other ant tasks, but nothing with args like above. I have got as far as this:
plugins
java
repositories
mavenCentral()
dependencies
runtime ("com.h2database:h2:1.3.168")
tasks
register("startH2Database")
group = "database"
description = "Starts the H2 TCP database server on port 9092 and web admin on port 8082"
doLast
ant.withGroovyBuilder
"java"("fork" to true, "spawn" to true, "classname" to "org.h2.tools.Server", "dir" to projectDir)
How do I configure the args and the classpath? Is there any extra documentation other than what's listed here: https://docs.gradle.org/current/userguide/ant.html?
java gradle kotlin ant
I have a gradle ant task that starts a H2 database. The build script looks like this:
apply plugin: 'java'
repositories
mavenCentral()
dependencies
runtime 'com.h2database:h2:1.3.168'
task startH2Db
group = 'database'
description='Starts the H2 TCP database server on port 9092 and web admin on port 8082'
doLast
ant.java( fork:true, spawn:true, classname:'org.h2.tools.Server', dir:projectDir)
arg(value: "-tcp")
arg(value: "-web")
arg(value: "-tcpPort")
arg(value: "9092")
arg(value: "-webPort")
arg(value: "8082")
arg(value: "-webAllowOthers")
classpath
pathelement(path:"$sourceSets.main.runtimeClasspath.asPath")
Given that Gradle are now supporting Kotlin, I decided to try and convert this build.gradle into a build.gradle.ktsfile.
I'm struggling to find documentation on how to do this in Kotlin. I've found examples of other ant tasks, but nothing with args like above. I have got as far as this:
plugins
java
repositories
mavenCentral()
dependencies
runtime ("com.h2database:h2:1.3.168")
tasks
register("startH2Database")
group = "database"
description = "Starts the H2 TCP database server on port 9092 and web admin on port 8082"
doLast
ant.withGroovyBuilder
"java"("fork" to true, "spawn" to true, "classname" to "org.h2.tools.Server", "dir" to projectDir)
How do I configure the args and the classpath? Is there any extra documentation other than what's listed here: https://docs.gradle.org/current/userguide/ant.html?
java gradle kotlin ant
java gradle kotlin ant
edited Mar 6 at 18:49
Ben Green
asked Mar 6 at 18:43
Ben GreenBen Green
2,90711936
2,90711936
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You may check more examples in the Gradle Kotlin DSL repository, e.g.
https://github.com/gradle/kotlin-dsl/blob/master/samples/ant/build.gradle.kts
So your Ant call may look like
ant.withGroovyBuilder
"java"(
"fork" to true,
"spawn" to true,
"classname" to "org.h2.tools.Server",
"dir" to projectDir
)
"arg"("value" to "-tcp")
"arg"("value" to "-web")
"arg"("value" to "-tcpPort")
"arg"("value" to "9092")
"arg"("value" to "-webPort")
"arg"("value" to "8082")
"arg"("value" to "-webAllowOthers")
"classpath"
"pathelement"(
"path" to configurations["runtime"].asPath
)
Wow. So simple! Thanks for the help :)
– Ben Green
Mar 6 at 19:10
1
I have edited the answer to show the exact solution.
– Ben Green
Mar 7 at 9:06
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55030116%2fhow-to-convert-gradle-ant-java-task-to-kotlin%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You may check more examples in the Gradle Kotlin DSL repository, e.g.
https://github.com/gradle/kotlin-dsl/blob/master/samples/ant/build.gradle.kts
So your Ant call may look like
ant.withGroovyBuilder
"java"(
"fork" to true,
"spawn" to true,
"classname" to "org.h2.tools.Server",
"dir" to projectDir
)
"arg"("value" to "-tcp")
"arg"("value" to "-web")
"arg"("value" to "-tcpPort")
"arg"("value" to "9092")
"arg"("value" to "-webPort")
"arg"("value" to "8082")
"arg"("value" to "-webAllowOthers")
"classpath"
"pathelement"(
"path" to configurations["runtime"].asPath
)
Wow. So simple! Thanks for the help :)
– Ben Green
Mar 6 at 19:10
1
I have edited the answer to show the exact solution.
– Ben Green
Mar 7 at 9:06
add a comment |
You may check more examples in the Gradle Kotlin DSL repository, e.g.
https://github.com/gradle/kotlin-dsl/blob/master/samples/ant/build.gradle.kts
So your Ant call may look like
ant.withGroovyBuilder
"java"(
"fork" to true,
"spawn" to true,
"classname" to "org.h2.tools.Server",
"dir" to projectDir
)
"arg"("value" to "-tcp")
"arg"("value" to "-web")
"arg"("value" to "-tcpPort")
"arg"("value" to "9092")
"arg"("value" to "-webPort")
"arg"("value" to "8082")
"arg"("value" to "-webAllowOthers")
"classpath"
"pathelement"(
"path" to configurations["runtime"].asPath
)
Wow. So simple! Thanks for the help :)
– Ben Green
Mar 6 at 19:10
1
I have edited the answer to show the exact solution.
– Ben Green
Mar 7 at 9:06
add a comment |
You may check more examples in the Gradle Kotlin DSL repository, e.g.
https://github.com/gradle/kotlin-dsl/blob/master/samples/ant/build.gradle.kts
So your Ant call may look like
ant.withGroovyBuilder
"java"(
"fork" to true,
"spawn" to true,
"classname" to "org.h2.tools.Server",
"dir" to projectDir
)
"arg"("value" to "-tcp")
"arg"("value" to "-web")
"arg"("value" to "-tcpPort")
"arg"("value" to "9092")
"arg"("value" to "-webPort")
"arg"("value" to "8082")
"arg"("value" to "-webAllowOthers")
"classpath"
"pathelement"(
"path" to configurations["runtime"].asPath
)
You may check more examples in the Gradle Kotlin DSL repository, e.g.
https://github.com/gradle/kotlin-dsl/blob/master/samples/ant/build.gradle.kts
So your Ant call may look like
ant.withGroovyBuilder
"java"(
"fork" to true,
"spawn" to true,
"classname" to "org.h2.tools.Server",
"dir" to projectDir
)
"arg"("value" to "-tcp")
"arg"("value" to "-web")
"arg"("value" to "-tcpPort")
"arg"("value" to "9092")
"arg"("value" to "-webPort")
"arg"("value" to "8082")
"arg"("value" to "-webAllowOthers")
"classpath"
"pathelement"(
"path" to configurations["runtime"].asPath
)
edited Mar 7 at 9:05
Ben Green
2,90711936
2,90711936
answered Mar 6 at 18:52
Eugene PetrenkoEugene Petrenko
2,6131825
2,6131825
Wow. So simple! Thanks for the help :)
– Ben Green
Mar 6 at 19:10
1
I have edited the answer to show the exact solution.
– Ben Green
Mar 7 at 9:06
add a comment |
Wow. So simple! Thanks for the help :)
– Ben Green
Mar 6 at 19:10
1
I have edited the answer to show the exact solution.
– Ben Green
Mar 7 at 9:06
Wow. So simple! Thanks for the help :)
– Ben Green
Mar 6 at 19:10
Wow. So simple! Thanks for the help :)
– Ben Green
Mar 6 at 19:10
1
1
I have edited the answer to show the exact solution.
– Ben Green
Mar 7 at 9:06
I have edited the answer to show the exact solution.
– Ben Green
Mar 7 at 9:06
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55030116%2fhow-to-convert-gradle-ant-java-task-to-kotlin%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown