Questions tagged [gradle-custom-plugin]

A Gradle plugin packages up reusable pieces of build logic, which can be used across many different projects and builds. Gradle allows you to implement your own custom plugins, so you can reuse your build logic, and share it with others.

A Gradle plugin packages up reusable pieces of build logic, which can be used across many different projects and builds. Gradle allows you to implement your own custom plugins, so you can reuse your build logic, and share it with others.

More Details

21 questions
12
votes
4 answers

Programmatically invoke a gradle task graph in a unit test

I am in the process of writing a custom plugin for gradle and as part of the unit testing I would like to invoke my task but in such away as it's prerequisite tasks are executed. The actual plugin is unfortunately an internal project so I can't sure…
Gareth Davis
  • 27,701
  • 12
  • 73
  • 106
7
votes
2 answers

How to depend on all *compile and *testCompile tasks in Gradle

I would like to have in animalSniffer plugin one task to depend on compilation of all production classes (Java, Groovy, Scala) in all sourceSets and the second to depend on compilation of all test classes in all sourceSets (possibly separate test…
Marcin Zajączkowski
  • 4,036
  • 1
  • 32
  • 41
5
votes
0 answers

Gradle Custom Plugin task .dependsOn with Command line parameters

I'm developing a custom Gradle Plugin that depends on another plugin. For a specific task to run I have to run a task from an external plugin first. project.tasks.create("MyTaskName", MyTaskName) { it.description =…
JoschJava
  • 1,152
  • 12
  • 20
3
votes
2 answers

How to configure Gradle Java plugin from a custom Gradle plugin

I've written a custom Gradle plugin in Kotlin 1.2.50 for use with Gradle 4.8. I've successfully applied the Java plugin from my plugin's apply method: override fun apply(project: Project) { project.pluginManager.apply(JavaPlugin::class.java) …
XDR
  • 4,070
  • 3
  • 30
  • 54
3
votes
1 answer

Allow Gradle plugin to use its configuration to conditionally apply other plugins

In the plugin I would like to be able to choose what other plugins apply (e.g. Nexus plugin or Bintray plugin, but not both) based on a configuration placed by a user in the configuration closure for my plugin. I normally get the configuration for…
Marcin Zajączkowski
  • 4,036
  • 1
  • 32
  • 41
2
votes
1 answer

Better way to organize gradle pluginManagement block

Below is a example where, in order to add a custom-plugin to the application, we need to specify it dependency in resolution strategy and by using useModule, to add it in classpath -------build.gradle---------- plugins { id…
Dan
  • 651
  • 1
  • 14
  • 31
2
votes
2 answers

How do I set task properties in a Gradle Plugin

I am creating a gradle plugin to apply the sonar-runner plugin and default many of the values such as the sonar host URL and the sonar JDBC URL. I cannot figure out how to set the properties though. When I set this up in build.gradle I use: apply…
Rylander
  • 19,449
  • 25
  • 93
  • 144
2
votes
1 answer

Execute Java class with separate classpath from Gradle plugin

In my plugin I need to execute static bootstrapping method from an external JAR to perform an analysis. Currently I call it directly from code with MutationCoverageReport.main(arg), but this forces me to create a compile time dependency in my plugin…
Marcin Zajączkowski
  • 4,036
  • 1
  • 32
  • 41
1
vote
0 answers

Custom Gradle Plugin: Task not found when adding grgit.checkout

I'm writing a custom gradle plugin. I'm working on two tasks at the moment: project.tasks.create("prepareCustomTask", PrepareCustomTask) { it.group = TASK_GROUP it.description = "Prepares custom task" } project.tasks.create("customTask",…
JoschJava
  • 1,152
  • 12
  • 20
1
vote
1 answer

Adding project resources to Gradle Custom plugin

I am building a Custom gradle plugin which when applied to the projects will use the configuration files in the project resources folder to fill some templates and generate some other configuration files. But when I read the files in my plugin as…
1
vote
1 answer

Gradle : Multiple subtasks share the same extension variable object

I have created a custom Gradle plugin like this, DummyPlugin.java public class DummyPlugin implements Plugin { @Override public void apply(Project project) { project.getTasks().create("dummy", DummyTask.class); …
Msp
  • 2,493
  • 2
  • 20
  • 34
1
vote
1 answer

Get error "You do not have sufficient permissions to access this page" While creating custom plugin

I have created custom plugin in wordpress for get data from the database. And I have added two link to perfrom action on records .One is Edit and another is Delete. I have written code for delete link like this
Nisarg Bhavsar
  • 946
  • 2
  • 18
  • 40
1
vote
2 answers

How to allow user to change the version of the library which is used by a plugin in Gradle?

In my plugin I call static bootstrapping method MutationCoverageReport.main(arg) from a library which is a compile dependency of my plugin. I would like to allow a plugin user to change the version of the library which should be used (assuming the…
Marcin Zajączkowski
  • 4,036
  • 1
  • 32
  • 41
1
vote
1 answer

What method am I missing? MissingMethodException on project.apply plugin: 'customPlugin'

What method am I missing? I am getting a MissingMethodException on project.apply plugin: 'env' Here is my code: --EnvPluginTest.groovy package com.gradle.env; import static org.junit.Assert.* import org.junit.Test import org.gradle.api.* import…
Eric Francis
  • 23,039
  • 31
  • 88
  • 122
0
votes
0 answers

How to display category id at database and at frontend display category name with an array?

I am currently working on another custom plugin of Wordpress named as game-plugin. I have fields like Id,Name,Category,Image,Popularity,Company,Content. I am trying to insert category id at my database table game_db and I want to fetch my selected…
1
2