Maven:无法执行Avro目标(编译协议文件时出错)



我有一些使用自定义逻辑类型的Avro文件。当我尝试使用mvn clean install来构建我的项目,以便自动生成我的Java类时。我尝试了以下Street类型的实现示例(https://github.com/markush81/avro-examples)。我得到以下错误:

Failed to execute goal org.apache.avro:avro-maven-plugin:1.11.0:schema (schemas) on project atlas_v: Error compiling protocol file to projectsrcmainjava

下面是我的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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.vadis</groupId>
<artifactId>atlas_v</artifactId>
<version>1.2</version>

<properties>
<java.version>1.8</java.version>
<atlas.version>2.0.0</atlas.version>
<avro.version>1.11.0</avro.version>
<spark.version>3.0.1</spark.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<distributionManagement>
<repository>
<id>gitlab-atlas</id>
<!--suppress UnresolvedMavenProperty -->
<url>${CI_API_V4_URL}/projects/${env.CI_PROJECT_ID}/packages/maven</url>
</repository>
<snapshotRepository>
<id>gitlab-atlas</id>
<!--suppress UnresolvedMavenProperty -->
<url>${CI_API_V4_URL}/projects/${env.CI_PROJECT_ID}/packages/maven</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
.......
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>${avro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.atlas</groupId>
<artifactId>atlas-common</artifactId>
<version>${atlas.version}</version>
</dependency>
<dependency>
<groupId>org.apache.atlas</groupId>
<artifactId>atlas-client-v2</artifactId>
<version>${atlas.version}</version>
</dependency>
<dependency>
<groupId>org.apache.atlas</groupId>
<artifactId>atlas-client-v1</artifactId>
<version>${atlas.version}</version>
</dependency>
.... dependencies
</dependencies>
<build>
<plugins>
.... others plugins
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>${avro.version}</version>
<executions>
<execution>
<id>schemas</id>
<phase>generate-sources</phase>
<goals>
<goal>schema</goal>
<goal>protocol</goal>
<goal>idl-protocol</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceDirectory>${project.basedir}/src/main/resources/</sourceDirectory>
<outputDirectory>${project.basedir}/src/main/java/</outputDirectory>
<enableDecimalLogicalType>true</enableDecimalLogicalType>
<customConversions>
<customConversion>com.vadis.atlas_v.model.avro.utils.StreetConversion</customConversion>
</customConversions>
<customLogicalTypeFactories>                       

<customLogicalTypeFactory>com.vadis.atlas_v.model.avro.utils.StreetLogicalTypeFactory</customLogicalTypeFactory>
</customLogicalTypeFactories>
</configuration>
</plugin>
</plugins>
</build>
</project>

我也有同样的错误。我的问题是Avro正在编译的.java源文件已经存在,并且由另一个用户所有。