Closed kazurayam closed 1 year ago
https://discuss.gradle.org/t/maven-publish-not-outputting-dependencies-to-pom/10916/14
Using “artifacts jar” loses the dependency information. But I think that makes sense.
This is correct. An artifact is exactly that, just some file. No dependency information included. A component however includes metadata about dependencies that we can include in the POM.
I have got a solution to this issue. See
https://github.com/kazurayam/Gradle_MavenPublish_generates_no_dependencies_in_pom_for_multiproject
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://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">
<!-- This module was also published with a richer model, Gradle metadata, -->
<!-- which should be used instead. Do not delete the following line which -->
<!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
<!-- that they should prefer consuming it instead. -->
<!-- do_not_remove: published-with-gradle-metadata -->
<modelVersion>4.0.0</modelVersion>
<groupId>com.kazurayam</groupId>
<artifactId>materialstore</artifactId>
<version>0.13.0</version>
<name>materialstore</name>
<description>A Java/Groovy API to store objects (Screenshots, HTML, JSON, XML) collected during End-to-end testings, plus empowered by diffing and reporting tools</description>
<url>https://kazurayam.github.io/materialstore/</url>
<licenses>
<license>
<name>The Apache License, Version 2.0</name>
<url>https://www.apache.org.licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<developers>
<developer>
<id>kazurayam</id>
<name>URAYAMA,kazuaki</name>
<email>kazuaki.urayama@gmail.com</email>
</developer>
</developers>
<scm>
<connection>scm:git:https://github.com/kazurayam/materialstore.git</connection>
<developerConnection>scm:git:git@github.com:kazurayam/materialstore.git</developerConnection>
<url>https://github.com/kazurayam/materialstore</url>
</scm>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.github.java-diff-utils</groupId>
<artifactId>java-diff-utils</artifactId>
<version>4.11</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.rometools</groupId>
<artifactId>rome</artifactId>
<version>1.18.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.ashot</groupId>
<artifactId>ashot</artifactId>
<version>1.5.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.9.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.31</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.14.3</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>net.sf.cssbox</groupId>
<artifactId>pdf2dom</artifactId>
<version>2.0.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.26</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox-tools</artifactId>
<version>2.0.26</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.kazurayam</groupId>
<artifactId>subprocessj</artifactId>
<version>0.3.4</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
v0.12.5, the pom.xml of the materialstore v0.12.5 is as this:
There is no
<dependency>
element. Why?Because the POM does not declare the dependency, all project that wants to use the materialstore can not resolve the external dependencies .