Skip to content
Novus Examples
gradle1.2 KB

Gradle Build Script (Groovy DSL)

A Gradle Groovy DSL build script with a plugins block, a Java toolchain, five dependency configurations, task configuration via named() and a registered task. Every coordinate and repository is fictional, so nothing resolves.

Preview — first 50 linesgradle
// Gradle Groovy DSL build script. A parsing fixture: no plugin resolution, no dependency
// download, and every coordinate is a fictional example-org artifact.

plugins {
    id 'java-library'
    id 'jacoco'
    id 'com.example.internal.conventions' version '2.3.0'
}

group = 'com.example.orders'
version = '1.4.0'
description = 'Fictional orders library used as a build-file fixture.'

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
    withSourcesJar()
}

repositories {
    maven {
        name = 'example-internal'
        url = uri('https://maven.example.invalid/releases')
    }
}

dependencies {
    api 'com.example.lib:core:3.2.1'
    implementation 'com.example.lib:http:1.8.0'
    compileOnly 'com.example.lib:annotations:1.0.0'
    testImplementation 'com.example.test:harness:4.1.0'
    testRuntimeOnly 'com.example.test:runner:4.1.0'
}

tasks.named('test') {
    useJUnitPlatform()
    maxParallelForks = 2
    testLogging {
        events 'passed', 'skipped', 'failed'
    }
    finalizedBy tasks.named('jacocoTestReport')
}

tasks.register('printVersion') {
    doLast {
        println "orders ${project.version}"
    }
}
57 lines total — download for the full file.

Specifications

Plugins
3
Dependency Configurations
5
Registered Tasks
1
Configured Tasks
2
Toolchain Version
21
Repository Host
maven.example.invalid

Testing contract

Expected to pass
Scenario
Extract declared dependencies and their configurations from a Groovy Gradle script
Expected result
Five dependency declarations resolve across api, implementation, compileOnly, testImplementation and testRuntimeOnly, each with a parsed group:name:version coordinate

What is a .gradle file?

A .gradle file is a Gradle build script written in the Groovy DSL. It configures a project through blocks such as plugins, repositories, dependencies, and tasks, where each block is really a Groovy closure evaluated against a delegate object — which is why a build script is executable code rather than static configuration. The Kotlin DSL equivalent uses the .gradle.kts extension.

How to use this file

Use an example .gradle file to test build-script parsers, dependency extractors, and SBOM generators, verifying that dependency coordinates are read from each configuration, that plugin declarations are found, and that dynamic version ranges are surfaced rather than resolved.

How to use this file for testing

“Gradle Build Script (Groovy DSL)” is a deterministic Novus Examples fixture for Config parsing, Syntax highlighting, Editor testing. TOML and INI configuration files with nested sections and typed values — for testing config parsers and loaders.

Documented properties for this file: GRADLE · 1,277 bytes. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Pipeline and infrastructure fixtures are inert configuration: steps reference fictional images and scripts, and nothing here executes. Run your linter, schema validator, migrator, or policy engine against them, and expect the deprecated-syntax and intentionally invalid variants to be rejected.

Point your config loader at the file and assert it reads the documented sections and typed values, including any deliberately-tricky nesting or comments.

Generated by generation/pipelines.py. Free for any use, no attribution required — license.