# Implementing Tasks with Command-line Arguments Sample

version 7.6

- Groovy DSL

- Kotlin DSL

| You can open the samples inside an IDE using the IntelliJ native importer or Eclipse Buildship.

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

build.gradle

    plugins {
        id 'com.example.project-info'
    }

    version = '1.0.2'

settings.gradle

    rootProject.name = 'task-with-arguments'
    includeBuild('project-info')

build.gradle.kts

    plugins {
        id("com.example.project-info")
    }

    version = "1.0.2"

settings.gradle.kts

    rootProject.name = "task-with-arguments"
    includeBuild("project-info")

To execute the sample task:

    $ ./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 Gradle Plugins reference chapter. You can also get started quickly using the Build Init Plugin.