Hello everyone. I am trying to test out if using W...
# squarelibraries
d
Hello everyone. I am trying to test out if using Wire for gRPC is viable for me. However I already fail at the first step: Using the Gradle plugin. The documentation says I just need to add it to the
plugins
block (even without a version, huh?), but the plugin does not seem to be published to the Gradle plugins maven... Even adding mavenCentral to the plugins repositories does not help, even though the plugin seems to be published there.
My build.gradle.kts:
Copy code
plugins {
    kotlin("jvm") version "1.3.61"
    id("com.squareup.wire") version "3.0.3"
}

group = "org.example"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
}

dependencies {
    implementation(kotlin("stdlib-jdk8"))
}

tasks {
    compileKotlin {
        kotlinOptions.jvmTarget = "1.8"
    }
    compileTestKotlin {
        kotlinOptions.jvmTarget = "1.8"
    }
}
The error output:
Copy code
FAILURE: Build failed with an exception.

* Where:
Build file 'E:\code\wireTest\build.gradle.kts' line: 1

* What went wrong:
Plugin [id: 'com.squareup.wire', version: '3.0.3'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'com.squareup.wire:com.squareup.wire.gradle.plugin:3.0.3')
  Searched in the following repositories:
    Gradle Central Plugin Repository
    MavenRepo

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at <https://help.gradle.org>
I am using Gradle version 5.6.3.
d
I think you need this in your
settings.gradle.kts
.
Copy code
pluginManagement {	
	repositories {	
		jcenter()	
		mavenCentral()	
		maven("<https://plugins.gradle.org/m2/>")
	}	

	resolutionStrategy {	
		eachPlugin {
			if (requested.id.id == "com.squareup.wire") {
				useModule("com.squareup.wire:wire-gradle-plugin:${requested.version}")	
			}	
		}
	}
}
d
Seems to work, thanks! Very strange...
d
Long story short, the
plugins
block is fairly limited out of the box.
d
Yeah, what I find strange is that this is mentioned nowhere in the documentation.
g
Gradle plugins should publish plugin descriptor to repository, so it will allow to consume it without manual mapping, or just publish to Gradle plugin portal