Skip to content

Conversation

natiginfo
Copy link

Before this PR

The revapi-gradle-plugin unconditionally applies the org.gradle.api.plugins.JavaPlugin to any project it is applied to. This causes a conflict and build failure (e.g., "Cannot add task 'test' as a task with that name already exists") if another plugin that provides Java capabilities (like com.android.library, com.android.application, or even java-library itself) has already been applied to the project. This limits the plugin's applicability in common Gradle setups, especially for Android projects or multi-project builds where base Java functionality is established by other dedicated plugins.

After this PR

The revapi-gradle-plugin will now conditionally apply the org.gradle.api.plugins.JavaPlugin. It first checks if the project already has a compatible Java plugin (java, java-library, com.android.library, com.android.application) applied. If such a plugin is detected, revapi-gradle-plugin will skip applying JavaPlugin itself, thus avoiding task registration conflicts.

Possible downsides?

Not that I can think of since JavaPlugin will still be applied in other cases.

This pull request addresses an issue where the revapi-gradle-plugin unconditionally applies the org.gradle.api.plugins.JavaPlugin. This can lead to build failures in projects where a compatible Java plugin (like com.android.library or java-library itself) is already applied, resulting in errors such as "Cannot add task 'test' as a task with that name already exists."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant