autonomousapps/dependency-analysis-gradle-plugin

Class parameter in annotation detected as api-dependency

開放

#1,533 建立於 2025年8月26日

 (3 則留言) (1 個反應) (0 位負責人)Kotlin (154 個分叉)auto 404
bughelp wantedtoolchain:java

倉庫指標

星標
 (2,172 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Plugin version: 3.0.1 Gradle version: 9.0.0 JDK version: 21 Describe the bug After issue #1210 I was under the impression, that following code would add module2 only as implementation dependency:

package com.example.demo;

import com.example.module2.Module2Config;
import org.springframework.context.annotation.Import;

@Import(Module2Config.class)
public class Module1Config {
}

But fails with:

./gradlew buildHealth
  Existing dependencies which should be modified to be as indicated:
    api project(':module2') (was implementation)

With reason:

./gradlew :module1:reason --id :module2
Source: main
------------
* Exposes 1 class: com.example.module2.Module2Config (implies api).

To Reproduce I have a small example project to reproduce it: repro-annotation.zip

Expected behavior It should only be an implementation-dependency.

貢獻者指南