Dagger2 Maven: Missing POM for com.google.devtools.ksp:symbo



我是新来的。这是我的pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>trace-ingester</artifactId>
<groupId>com.pandepra</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>trace-ingester-deploy</artifactId>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming-kafka-0-10_${scala.version.major}</artifactId>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${scala.version.major}</artifactId>
</dependency>
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
</dependency>
<dependency>
<groupId>com.pandepra</groupId>
<artifactId>trace-ingester-module</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_${scala.version.major}</artifactId>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
</dependency>
<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>com.google.dagger</groupId>
<artifactId>dagger-compiler</artifactId>
<version>2.38.1</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>create-fat-jar</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<excludes>META-INF/*.SF</excludes>
<excludes>META-INF/*.DSA</excludes>
<excludes>META-INF/*.RSA</excludes>
<includes>
<include>org.apache.spark:spark-streaming-kafka-0-10_${scala.version.major}</include>
<include>org.apache.spark:spark-sql_${scala.version.major}</include>
<include>org.apache.spark:spark-streaming_${scala.version.major}</include>
<include>com.typesafe:config</include>
</includes>
</artifactSet>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.pandepra.traceingester.TraceIngesterApplication</mainClass>
</transformer>
</transformers>
<finalName>trace-ingester-uber-jar</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

应用程序在Intellij中运行良好。然而,在做maven clean install时,我得到以下错误:

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project trace-ingester-module: Resolution of annotationProcessorPath dependencies failed: Missing:
[ERROR] ----------
[ERROR] 1) com.google.devtools.ksp:symbol-processing-api:jar:1.5.20-1.0.0-beta03
[ERROR] 
[ERROR]   Try downloading the file manually from the project website.
[ERROR] 
[ERROR]   Then, install it using the command: 
[ERROR]       mvn install:install-file -DgroupId=com.google.devtools.ksp -DartifactId=symbol-processing-api -Dversion=1.5.20-1.0.0-beta03 -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 
[ERROR]   Alternatively, if you host your own repository you can deploy the file there: 
[ERROR]       mvn deploy:deploy-file -DgroupId=com.google.devtools.ksp -DartifactId=symbol-processing-api -Dversion=1.5.20-1.0.0-beta03 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR] 
[ERROR]   Path to dependency: 
[ERROR]         1) com.google.dagger:dagger-compiler:jar:2.38.1
[ERROR]         2) com.google.dagger:dagger-spi:jar:2.38.1
[ERROR]         3) com.google.devtools.ksp:symbol-processing-api:jar:1.5.20-1.0.0-beta03
[ERROR] 
[ERROR] ----------
[ERROR] 1 required artifact is missing.
[ERROR] 
[ERROR] for artifact: 
[ERROR]   com.google.dagger:dagger-compiler:jar:2.38.1
[ERROR] 
[ERROR] from the specified remote repositories:
[ERROR]   central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false)
[ERROR] Path to dependency: 
[ERROR]         1) com.google.dagger:dagger-compiler:jar:2.38.1

官方文档不要求我们添加任何其他依赖项。我做错了什么?它是一个多模块项目,有一个父模块。

添加:

<repositories>
<repository>
<id>google-maven</id>
<name>Google Maven Repo</name>
<url>https://maven.google.com</url>
</repository>
</repositories>

参考:https://github.com/google/dagger/releases: ~:文本= New % 20 % 20dagger,新% 20打破% 20的变化,制造% 20的% 20谷歌

最新更新