#maven #gradle #transitive-dependency
#maven #gradle #транзитивная зависимость
Вопрос:
Я импортирую зависимость в свой проект, который сам требует другой (com.discord4j). Gradle, похоже, знает об этой транзитивной зависимости, как показано в выводе gradle dependencies
команды ниже (discord4j отображается в соответствии с требованиями com.bancarelvalentin.genericbot при компиляции и выполнении). Но я не могу импортировать его, поскольку его имя не может быть разрешено.
Я не эксперт, когда дело доходит до gradle, поэтому я, безусловно, упускаю что-то очевидное. Кто-нибудь может помочь найти что?
РЕДАКТИРОВАТЬ: В конце концов, кажется, что транзитивная зависимость не добавляется в compileClasspath . Почему ?
РЕДАКТИРОВАНИЕ 2: я исправил файл POM корневой библиотеки; он доступен здесь, но приведенный выше снимок экрана по-прежнему является тем, что я получил в моем compileClasspath; Я очистил все кэши (InteliJ et Gradle), но ничто не приведет к тому, что мужской gradle поместит эту библиотеку в путь к классу
14:34:16: Executing task 'dependencies'...
> Task :dependencies
------------------------------------------------------------
Root project
------------------------------------------------------------
-api (n)
No dependencies
-runtime (n)
No dependencies
annotationProcessor - Annotation processors and their dependencies for source set 'main'.
No dependencies
api - API dependencies for compilation 'main' (target (jvm)). (n)
No dependencies
apiDependenciesMetadata
No dependencies
apiElements - API elements for main. (n)
No dependencies
archives - Configuration for archive artifacts. (n)
No dependencies
compileClasspath - Compile classpath for compilation 'main' (target (jvm)).
--- org.jetbrains.kotlin:kotlin-stdlib:1.4.10
| --- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.10
| --- org.jetbrains:annotations:13.0
--- com.bancarelvalentin:genericbot:0.0.4
compileOnly - Compile only dependencies for compilation 'main' (target (jvm)). (n)
No dependencies
compileOnlyDependenciesMetadata
No dependencies
default - Configuration for default artifacts. (n)
No dependencies
implementation - Implementation only dependencies for compilation 'main' (target (jvm)). (n)
--- org.jetbrains.kotlin:kotlin-stdlib:1.4.10 (n)
--- com.bancarelvalentin:genericbot:0.0.4 (n)
implementationDependenciesMetadata
--- org.jetbrains.kotlin:kotlin-stdlib:1.4.10
| --- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.10
| --- org.jetbrains:annotations:13.0
--- com.bancarelvalentin:genericbot:0.0.4
kotlinCompilerClasspath
--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.4.10
--- org.jetbrains.kotlin:kotlin-stdlib:1.4.10
| --- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.10
| --- org.jetbrains:annotations:13.0
--- org.jetbrains.kotlin:kotlin-script-runtime:1.4.10
--- org.jetbrains.kotlin:kotlin-reflect:1.4.10
| --- org.jetbrains.kotlin:kotlin-stdlib:1.4.10 (*)
--- org.jetbrains.kotlin:kotlin-daemon-embeddable:1.4.10
--- org.jetbrains.intellij.deps:trove4j:1.0.20181211
kotlinCompilerPluginClasspath
--- org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.4.10
--- org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.4.10
| --- org.jetbrains.kotlin:kotlin-scripting-common:1.4.10
| | --- org.jetbrains.kotlin:kotlin-stdlib:1.4.10
| | | --- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.10
| | | --- org.jetbrains:annotations:13.0
| | --- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7
| | --- org.jetbrains.kotlin:kotlin-stdlib:1.3.71 -> 1.4.10 (*)
| | --- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.71 -> 1.4.10
| --- org.jetbrains.kotlin:kotlin-scripting-jvm:1.4.10
| | --- org.jetbrains.kotlin:kotlin-script-runtime:1.4.10
| | --- org.jetbrains.kotlin:kotlin-stdlib:1.4.10 (*)
| | --- org.jetbrains.kotlin:kotlin-scripting-common:1.4.10 (*)
| --- org.jetbrains.kotlin:kotlin-stdlib:1.4.10 (*)
| --- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7 (*)
--- org.jetbrains.kotlin:kotlin-stdlib:1.4.10 (*)
kotlinKlibCommonizerClasspath
--- org.jetbrains.kotlin:kotlin-klib-commonizer-embeddable:1.4.10
--- org.jetbrains.kotlin:kotlin-stdlib:1.4.10
| --- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.10
| --- org.jetbrains:annotations:13.0
--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.4.10
--- org.jetbrains.kotlin:kotlin-stdlib:1.4.10 (*)
--- org.jetbrains.kotlin:kotlin-script-runtime:1.4.10
--- org.jetbrains.kotlin:kotlin-reflect:1.4.10
| --- org.jetbrains.kotlin:kotlin-stdlib:1.4.10 (*)
--- org.jetbrains.kotlin:kotlin-daemon-embeddable:1.4.10
--- org.jetbrains.intellij.deps:trove4j:1.0.20181211
kotlinNativeCompilerPluginClasspath
No dependencies
kotlinScriptDef - Script filename extensions discovery classpath configuration
No dependencies
kotlinScriptDefExtensions
No dependencies
runtimeClasspath - Runtime classpath of compilation 'main' (target (jvm)).
--- org.jetbrains.kotlin:kotlin-stdlib:1.4.10
| --- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.10
| --- org.jetbrains:annotations:13.0
--- com.bancarelvalentin:genericbot:0.0.4
--- org.jetbrains.kotlin:kotlin-stdlib:1.4.10 (*)
--- com.discord4j:discord4j-core:3.1.0
| --- io.projectreactor:reactor-bom:Dysprosium-SR10
| | --- io.projectreactor.addons:reactor-extra:3.3.3.RELEASE (c)
| | --- io.projectreactor.netty:reactor-netty:0.9.10.RELEASE (c)
| | --- io.projectreactor:reactor-core:3.3.8.RELEASE (c)
| | --- org.reactivestreams:reactive-streams:1.0.3 (c)
| --- com.discord4j:discord-json:1.5.3
| | --- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.1
| | | --- com.fasterxml.jackson.core:jackson-core:2.11.1
| | | --- com.fasterxml.jackson.core:jackson-databind:2.11.1
| | | --- com.fasterxml.jackson.core:jackson-annotations:2.11.1
| | | --- com.fasterxml.jackson.core:jackson-core:2.11.1
| | --- com.discord4j:discord-json-api:1.5.3
| | | --- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.1 (*)
| | | --- com.fasterxml.jackson.core:jackson-databind:2.11.1 (*)
| | --- com.fasterxml.jackson.core:jackson-databind:2.11.1 (*)
| --- com.discord4j:discord4j-rest:3.1.0
| | --- io.projectreactor:reactor-bom:Dysprosium-SR10 (*)
| | --- com.discord4j:discord-json:1.5.3 (*)
| | --- com.discord4j:discord4j-common:3.1.0
| | --- io.projectreactor:reactor-bom:Dysprosium-SR10 (*)
| | --- com.discord4j:discord-json:1.5.3 (*)
| | --- io.projectreactor.netty:reactor-netty:0.9.10.RELEASE
| | | --- io.netty:netty-codec-http:4.1.51.Final
| | | | --- io.netty:netty-common:4.1.51.Final
| | | | --- io.netty:netty-buffer:4.1.51.Final
| | | | | --- io.netty:netty-common:4.1.51.Final
| | | | --- io.netty:netty-transport:4.1.51.Final
| | | | | --- io.netty:netty-common:4.1.51.Final
| | | | | --- io.netty:netty-buffer:4.1.51.Final (*)
| | | | | --- io.netty:netty-resolver:4.1.51.Final
| | | | | --- io.netty:netty-common:4.1.51.Final
| | | | --- io.netty:netty-codec:4.1.51.Final
| | | | | --- io.netty:netty-common:4.1.51.Final
| | | | | --- io.netty:netty-buffer:4.1.51.Final (*)
| | | | | --- io.netty:netty-transport:4.1.51.Final (*)
| | | | --- io.netty:netty-handler:4.1.51.Final
| | | | --- io.netty:netty-common:4.1.51.Final
| | | | --- io.netty:netty-resolver:4.1.51.Final (*)
| | | | --- io.netty:netty-buffer:4.1.51.Final (*)
| | | | --- io.netty:netty-transport:4.1.51.Final (*)
| | | | --- io.netty:netty-codec:4.1.51.Final (*)
| | | --- io.netty:netty-codec-http2:4.1.51.Final
| | | | --- io.netty:netty-common:4.1.51.Final
| | | | --- io.netty:netty-buffer:4.1.51.Final (*)
| | | | --- io.netty:netty-transport:4.1.51.Final (*)
| | | | --- io.netty:netty-codec:4.1.51.Final (*)
| | | | --- io.netty:netty-handler:4.1.51.Final (*)
| | | | --- io.netty:netty-codec-http:4.1.51.Final (*)
| | | --- io.netty:netty-handler:4.1.51.Final (*)
| | | --- io.netty:netty-handler-proxy:4.1.51.Final
| | | | --- io.netty:netty-common:4.1.51.Final
| | | | --- io.netty:netty-buffer:4.1.51.Final (*)
| | | | --- io.netty:netty-transport:4.1.51.Final (*)
| | | | --- io.netty:netty-codec:4.1.51.Final (*)
| | | | --- io.netty:netty-codec-socks:4.1.51.Final
| | | | | --- io.netty:netty-common:4.1.51.Final
| | | | | --- io.netty:netty-buffer:4.1.51.Final (*)
| | | | | --- io.netty:netty-transport:4.1.51.Final (*)
| | | | | --- io.netty:netty-codec:4.1.51.Final (*)
| | | | --- io.netty:netty-codec-http:4.1.51.Final (*)
| | | --- io.netty:netty-transport-native-epoll:4.1.51.Final
| | | | --- io.netty:netty-common:4.1.51.Final
| | | | --- io.netty:netty-buffer:4.1.51.Final (*)
| | | | --- io.netty:netty-transport:4.1.51.Final (*)
| | | | --- io.netty:netty-transport-native-unix-common:4.1.51.Final
| | | | --- io.netty:netty-common:4.1.51.Final
| | | | --- io.netty:netty-buffer:4.1.51.Final (*)
| | | | --- io.netty:netty-transport:4.1.51.Final (*)
| | | --- io.projectreactor:reactor-core:3.3.8.RELEASE
| | | --- org.reactivestreams:reactive-streams:1.0.3
| | --- io.projectreactor.addons:reactor-extra:3.3.3.RELEASE
| | | --- io.projectreactor:reactor-core:3.3.4.RELEASE -> 3.3.8.RELEASE (*)
| | --- com.fasterxml.jackson.core:jackson-databind:2.11.1 (*)
| | --- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.1 (*)
| --- com.discord4j:discord4j-gateway:3.1.0
| | --- io.projectreactor:reactor-bom:Dysprosium-SR10 (*)
| | --- com.discord4j:discord-json:1.5.3 (*)
| | --- com.discord4j:discord4j-common:3.1.0 (*)
| | --- io.projectreactor.addons:reactor-extra:3.3.3.RELEASE (*)
| --- com.discord4j:discord4j-voice:3.1.0
| | --- io.projectreactor:reactor-bom:Dysprosium-SR10 (*)
| | --- com.discord4j:discord-json:1.5.3 (*)
| | --- com.discord4j:discord4j-common:3.1.0 (*)
| | --- com.discord4j:simple-fsm:1.0.1
| --- com.discord4j:stores-jdk:3.1.3
| --- io.projectreactor:reactor-bom:Dysprosium-SR10 (*)
| --- com.discord4j:stores-api:3.1.3
| --- io.projectreactor:reactor-bom:Dysprosium-SR10 (*)
| --- io.projectreactor:reactor-core:3.3.8.RELEASE (*)
| --- com.austinv11.servicer:Servicer:1.0.3
| --- com.fasterxml.jackson.core:jackson-databind:2.11.1 (*)
--- com.google.code.gson:gson:2.3.1
--- ch.qos.logback:logback-classic:1.2.3
| --- ch.qos.logback:logback-core:1.2.3
| --- org.slf4j:slf4j-api:1.7.25 -> 1.7.30
--- org.slf4j:slf4j-api:1.7.30
runtimeElements - Elements of runtime for main. (n)
No dependencies
runtimeOnly - Runtime only dependencies for compilation 'main' (target (jvm)). (n)
No dependencies
runtimeOnlyDependenciesMetadata
No dependencies
sourceArtifacts (n)
No dependencies
testAnnotationProcessor - Annotation processors and their dependencies for source set 'test'.
No dependencies
testApi - API dependencies for compilation 'test' (target (jvm)). (n)
No dependencies
testApiDependenciesMetadata
No dependencies
testCompileClasspath - Compile classpath for compilation 'test' (target (jvm)).
--- org.jetbrains.kotlin:kotlin-stdlib:1.4.10
| --- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.10
| --- org.jetbrains:annotations:13.0
--- com.bancarelvalentin:genericbot:0.0.4
testCompileOnly - Compile only dependencies for compilation 'test' (target (jvm)). (n)
No dependencies
testCompileOnlyDependenciesMetadata
No dependencies
testImplementation - Implementation only dependencies for compilation 'test' (target (jvm)). (n)
No dependencies
testImplementationDependenciesMetadata
--- org.jetbrains.kotlin:kotlin-stdlib:1.4.10
| --- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.10
| --- org.jetbrains:annotations:13.0
--- com.bancarelvalentin:genericbot:0.0.4
testKotlinScriptDef - Script filename extensions discovery classpath configuration
No dependencies
testKotlinScriptDefExtensions
No dependencies
testRuntimeClasspath - Runtime classpath of compilation 'test' (target (jvm)).
--- org.jetbrains.kotlin:kotlin-stdlib:1.4.10
| --- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.10
| --- org.jetbrains:annotations:13.0
--- com.bancarelvalentin:genericbot:0.0.4
--- org.jetbrains.kotlin:kotlin-stdlib:1.4.10 (*)
--- com.discord4j:discord4j-core:3.1.0
| --- io.projectreactor:reactor-bom:Dysprosium-SR10
| | --- io.projectreactor.addons:reactor-extra:3.3.3.RELEASE (c)
| | --- io.projectreactor.netty:reactor-netty:0.9.10.RELEASE (c)
| | --- io.projectreactor:reactor-core:3.3.8.RELEASE (c)
| | --- org.reactivestreams:reactive-streams:1.0.3 (c)
| --- com.discord4j:discord-json:1.5.3
| | --- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.1
| | | --- com.fasterxml.jackson.core:jackson-core:2.11.1
| | | --- com.fasterxml.jackson.core:jackson-databind:2.11.1
| | | --- com.fasterxml.jackson.core:jackson-annotations:2.11.1
| | | --- com.fasterxml.jackson.core:jackson-core:2.11.1
| | --- com.discord4j:discord-json-api:1.5.3
| | | --- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.1 (*)
| | | --- com.fasterxml.jackson.core:jackson-databind:2.11.1 (*)
| | --- com.fasterxml.jackson.core:jackson-databind:2.11.1 (*)
| --- com.discord4j:discord4j-rest:3.1.0
| | --- io.projectreactor:reactor-bom:Dysprosium-SR10 (*)
| | --- com.discord4j:discord-json:1.5.3 (*)
| | --- com.discord4j:discord4j-common:3.1.0
| | --- io.projectreactor:reactor-bom:Dysprosium-SR10 (*)
| | --- com.discord4j:discord-json:1.5.3 (*)
| | --- io.projectreactor.netty:reactor-netty:0.9.10.RELEASE
| | | --- io.netty:netty-codec-http:4.1.51.Final
| | | | --- io.netty:netty-common:4.1.51.Final
| | | | --- io.netty:netty-buffer:4.1.51.Final
| | | | | --- io.netty:netty-common:4.1.51.Final
| | | | --- io.netty:netty-transport:4.1.51.Final
| | | | | --- io.netty:netty-common:4.1.51.Final
| | | | | --- io.netty:netty-buffer:4.1.51.Final (*)
| | | | | --- io.netty:netty-resolver:4.1.51.Final
| | | | | --- io.netty:netty-common:4.1.51.Final
| | | | --- io.netty:netty-codec:4.1.51.Final
| | | | | --- io.netty:netty-common:4.1.51.Final
| | | | | --- io.netty:netty-buffer:4.1.51.Final (*)
| | | | | --- io.netty:netty-transport:4.1.51.Final (*)
| | | | --- io.netty:netty-handler:4.1.51.Final
| | | | --- io.netty:netty-common:4.1.51.Final
| | | | --- io.netty:netty-resolver:4.1.51.Final (*)
| | | | --- io.netty:netty-buffer:4.1.51.Final (*)
| | | | --- io.netty:netty-transport:4.1.51.Final (*)
| | | | --- io.netty:netty-codec:4.1.51.Final (*)
| | | --- io.netty:netty-codec-http2:4.1.51.Final
| | | | --- io.netty:netty-common:4.1.51.Final
| | | | --- io.netty:netty-buffer:4.1.51.Final (*)
| | | | --- io.netty:netty-transport:4.1.51.Final (*)
| | | | --- io.netty:netty-codec:4.1.51.Final (*)
| | | | --- io.netty:netty-handler:4.1.51.Final (*)
| | | | --- io.netty:netty-codec-http:4.1.51.Final (*)
| | | --- io.netty:netty-handler:4.1.51.Final (*)
| | | --- io.netty:netty-handler-proxy:4.1.51.Final
| | | | --- io.netty:netty-common:4.1.51.Final
| | | | --- io.netty:netty-buffer:4.1.51.Final (*)
| | | | --- io.netty:netty-transport:4.1.51.Final (*)
| | | | --- io.netty:netty-codec:4.1.51.Final (*)
| | | | --- io.netty:netty-codec-socks:4.1.51.Final
| | | | | --- io.netty:netty-common:4.1.51.Final
| | | | | --- io.netty:netty-buffer:4.1.51.Final (*)
| | | | | --- io.netty:netty-transport:4.1.51.Final (*)
| | | | | --- io.netty:netty-codec:4.1.51.Final (*)
| | | | --- io.netty:netty-codec-http:4.1.51.Final (*)
| | | --- io.netty:netty-transport-native-epoll:4.1.51.Final
| | | | --- io.netty:netty-common:4.1.51.Final
| | | | --- io.netty:netty-buffer:4.1.51.Final (*)
| | | | --- io.netty:netty-transport:4.1.51.Final (*)
| | | | --- io.netty:netty-transport-native-unix-common:4.1.51.Final
| | | | --- io.netty:netty-common:4.1.51.Final
| | | | --- io.netty:netty-buffer:4.1.51.Final (*)
| | | | --- io.netty:netty-transport:4.1.51.Final (*)
| | | --- io.projectreactor:reactor-core:3.3.8.RELEASE
| | | --- org.reactivestreams:reactive-streams:1.0.3
| | --- io.projectreactor.addons:reactor-extra:3.3.3.RELEASE
| | | --- io.projectreactor:reactor-core:3.3.4.RELEASE -> 3.3.8.RELEASE (*)
| | --- com.fasterxml.jackson.core:jackson-databind:2.11.1 (*)
| | --- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.1 (*)
| --- com.discord4j:discord4j-gateway:3.1.0
| | --- io.projectreactor:reactor-bom:Dysprosium-SR10 (*)
| | --- com.discord4j:discord-json:1.5.3 (*)
| | --- com.discord4j:discord4j-common:3.1.0 (*)
| | --- io.projectreactor.addons:reactor-extra:3.3.3.RELEASE (*)
| --- com.discord4j:discord4j-voice:3.1.0
| | --- io.projectreactor:reactor-bom:Dysprosium-SR10 (*)
| | --- com.discord4j:discord-json:1.5.3 (*)
| | --- com.discord4j:discord4j-common:3.1.0 (*)
| | --- com.discord4j:simple-fsm:1.0.1
| --- com.discord4j:stores-jdk:3.1.3
| --- io.projectreactor:reactor-bom:Dysprosium-SR10 (*)
| --- com.discord4j:stores-api:3.1.3
| --- io.projectreactor:reactor-bom:Dysprosium-SR10 (*)
| --- io.projectreactor:reactor-core:3.3.8.RELEASE (*)
| --- com.austinv11.servicer:Servicer:1.0.3
| --- com.fasterxml.jackson.core:jackson-databind:2.11.1 (*)
--- com.google.code.gson:gson:2.3.1
--- ch.qos.logback:logback-classic:1.2.3
| --- ch.qos.logback:logback-core:1.2.3
| --- org.slf4j:slf4j-api:1.7.25 -> 1.7.30
--- org.slf4j:slf4j-api:1.7.30
testRuntimeOnly - Runtime only dependencies for compilation 'test' (target (jvm)). (n)
No dependencies
testRuntimeOnlyDependenciesMetadata
No dependencies
(c) - dependency constraint
(*) - dependencies omitted (listed previously)
(n) - Not resolved (configuration is not meant to be resolved)
A web-based, searchable dependency report is available by adding the --scan option.
BUILD SUCCESSFUL in 116ms
1 actionable task: 1 executed
14:34:16: Task execution finished 'dependencies'.
Ответ №1:
Что такое опубликованный pom com.bancarelvalentin:genericbot
?
если genericbot
модуль имеет только runtime
зависимости, то вы не увидите их в своем пути к классу компиляции, и, следовательно, IDE их не обнаружит.
Комментарии:
1. Я отредактировал механизм публикации genericbot (теперь называемый discordbot), чтобы установить область для компиляции. Вы можете увидеть реестр (с последней версией POM) здесь: gitlab.com/vba-templates/generic-bot/-/packages — Но когда я импортирую его в свой другой проект, его все еще нет в пути к классу компиляции (см. Предыдущий экран) — Версия, которую я пишу, равна 0.0.11
2. После еще нескольких настроек в моем build.gradle в discordbot; мой POM, наконец, именно то, что я хочу, чтобы это было без какого-либо теневого обходного пути; см. gitlab.com/vba-templates/generic-bot/-/packages/720923 . — Но мне не удается заставить это работать
3. ссылка на gitlab дает 404
4. Не первый. В любом случае, я обнаружил, что последняя проблема была не в зависимости, а в моем проекте. Я импортировал зависимость, уже присутствующую в качестве транзитивного dep, в мой бот; поэтому discord не компилировал ни один из этих транзитивов.