Skip to content

Dev Publish Plugin :: publish Gradle projects for local testing

License

Notifications You must be signed in to change notification settings

adamko-dev/dev-publish-plugin

Repository files navigation

GitHub license Gradle Plugin Portal

Dev Publish Gradle Plugin

Dev Publish is a Gradle plugin that publishes subprojects to a project-local directory, ready for functional testing.

Why Dev Publish?

Quick Start

If a subproject already publishes Maven artifacts, then apply DevPublish using the plugin ID dev.adamko.dev-publish and the latest version.

// build.gradle.kts

plugins {
  `maven-publish`
  id("dev.adamko.dev-publish") version "$devPublishPluginVersion>"
}

Any project can depend on publications from other subprojects

// build.gradle.kts
plugins {
  id("dev.adamko.dev-publish")
}

dependencies {
  devPublication(project(":some-other-subproject"))
}

Cross-project

Dev Publish is great for cross-project publications.

Given multiple subprojects:

.
└── root/
    ├── my-java-library/    
    │   └── build.gradle.kts
    │
    ├── my-kotlin-application/
    │   └── build.gradle.kts
    │
    └── functional-tests/
        └── build.gradle.kts

Both the 'Java library' and 'Kotlin application' subprojects publish using the Maven Publish Plugin.

// my-java-library/build.gradle.kts
plugins {
  `java-library`
  `maven-publish`
  id("dev.adamko.dev-publish")
}
// my-kotlin-application/build.gradle.kts
plugins {
  application
  kotlin("jvm")
  `maven-publish`
  id("dev.adamko.dev-publish")
}

The 'functional-tests' subproject can aggregate the publications and collect them into a project-local directory, ready for testing.

// functional-tests/build.gradle.kts
plugins {
  id("dev.adamko.dev-publish")
}

dependencies {
  devPublication(project(":my-java-library"))
  devPublication(project(":my-kotlin-application"))
}

tasks.test {
  // will publish all publications from 
  // :my-java-library and :my-kotlin-application
  // into the `devPublish.devMavenRepo` directory
  dependsOn(tasks.updateDevRepo)

  // provide devMavenRepo for use in tests
  environment(
    "MAVEN_DEV_REPO" to devPublish.devMavenRepo.asFile.get().invariantSeparatorsPath
  )
}

About

Dev Publish Plugin :: publish Gradle projects for local testing

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages