Переходная зависимость от толстяка - PullRequest
0 голосов
/ 19 апреля 2020

У меня есть fatJar (uberJar), ​​у которого есть только одна зависимость от гуавы. Я развернул его в своей артефакте (пакетах) на github (теперь есть только одна зависимость). Затем я создал новый проект и добавил зависимость из моей артефакты (mavenCentral, jCenter e. c. Disabled), попытался построить проект и получил ошибку

     Searched in the following locations:
       - https://maven.pkg.github.com/owner/reponame/com/google/guava/guava/28.2-jre/guava-28.2-jre.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html 

Если я добавил mavenCentral, проблема исчезла. Зачем Gradle пытаться скачать зависимость, если у нас она есть в fatJar? Есть способ настроить fatJar так, чтобы нам не нужно было загружать его из репозитория?

<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>ru.somename</groupId>
  <artifactId>hw01-gradle-guava-api</artifactId>
  <version>1.0.1</version>
  <name>hw01-gradle</name>
  <description>some description</description>
  <licenses>
    <license>
      <name>The Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>
  <developers>
    <developer>
      <id>#####</id>
      <name>#####</name>
      <email>####</email>
    </developer>
  </developers>
  <dependencies>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>28.2-jre</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
</project>

gitHub link, который создает buidld fatJar

...