:samples-dir: /home/tcagent1/agent/work/64493a816be20d5a/promote-projects/gradle/build/git-checkout/platforms/documentation/docs/build/working/samples/install/task-with-arguments
:gradle-version: 8.14.3

= Implementing Tasks with Command-line Arguments Sample

[.download]
- link:zips/sample_task_with_arguments-groovy-dsl.zip[icon:download[] Groovy DSL]
- link:zips/sample_task_with_arguments-kotlin-dsl.zip[icon:download[] Kotlin DSL]

NOTE: You can open the samples inside an IDE using the https://www.jetbrains.com/help/idea/gradle.html#gradle_import_project_start[IntelliJ native importer] or https://projects.eclipse.org/projects/tools.buildship[Eclipse Buildship].

This sample shows how to create a plugin with a task that accepts arguments.
The plugin is packaged via an included build.

====
include::sample[dir="kotlin",files="build.gradle.kts[];settings.gradle.kts[]"]
include::sample[dir="groovy",files="build.gradle[];settings.gradle[]"]
====

To execute the sample task:

====
[.testable-sample,dir="groovy"]
=====
[.sample-command]
----
$ ./gradlew projectInfo --format json
{
    "projectName": "task-with-arguments"
    "version": "1.0.2"
}

BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
----
=====
====

For more information, see link:{userManualPath}/custom_plugins.html[Gradle Plugins reference chapter].
You can also get started quickly using the link:{userManualPath}/build_init_plugin.html#sec:java_library[Build Init Plugin].
