Hi,
Don't know since when, the avro-maven-plugin cannot compile the Java code
generated from the avro.avsc file any more.
Here is my pom.xml file with the avro-maven-plugin:
<plugin> <groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>1.7.4</version> <executions>
<execution> <phase>generate-sources</phase>
<goals> <goal>schema</goal>
</goals> <configuration>
<sourceDirectory>${project.basedir}/src/main/resources/</sourceDirectory>
<outputDirectory>${project.basedir}/src/main/java/</outputDirectory>
</configuration> </execution>
</executions> </plugin>
But suddenly, I got a lot of maven COMPILATION ERROR, and the error message is
about:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile)
on project: Compilation failure: Compilation failure:[ERROR]
/home/xxx/src/main/java/com/xxx/avro/schema/emailcontent1/EmailContent.java:[195,41]
incompatible types[ERROR] found : java.lang.Object[ERROR] required:
java.lang.Long
All the error messages point to the Java class generated from the avro.asvc
file.
I tried version from 1.7.2 to 1.7.7 (This is the latest available from the
Maven repository), all have the same errors.
But I can manually compile the java class using the old "javac" way, without
any problem.
Like following, if I use the Avro 1.7.4 version
javac -cp
/home/.m2/repository/org/apache/avro/avro/1.7.4/avro-1.7.4.jar:/home/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.8.8/jackson-core-asl-1.8.8.jar
-d ../../../target/classes/ com/xxx/avro/schema/emailcontent1/EmailContent.java
Right now, I have to only use "mvn package", without do the "mvn clean ....".
If I do a mvn clean, it will clean the java class, and then the maven will try
to recompile the EmailContent.java, and will get COMPILATION ERROR.
I don't think this is an issue on my environment. I got the above error on my
Mac, then I get the source code in another Linux desktop, and get the same
error in the "mvn clean package".
This is a very frustrated error. Does any one else also face it recently?
Thanks
Yong