无法调用avro-maven插件 [英] Unable to invoke avro-maven plugin
问题描述
我的问题类似于无法使用Maven从.avsc编译并创建.avro文件
我已经尝试了所有可能的方法,检查了maven项目100次,但仍然无法运行avro-maven插件来为我的avsc文件生成代码.
I have tried all possible things, checked the maven project 100 times, still i am not able to run the avro-maven plugin to generate the code for my avsc file.
我已经阅读了以下帖子,并且遵循相同的内容,但没有成功 http://grepalex.com/2013/05/24/avro-maven/ https://github.com/phunt/avro-maven-plugin
i have read the following posts and followed the same, but to no success http://grepalex.com/2013/05/24/avro-maven/ https://github.com/phunt/avro-maven-plugin
我下载了上面的maven项目,在这里结果也是一样.
i downloaded the above maven project, and here also the result is same.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Avro Maven Example 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ avro-maven ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ avro-maven ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory F:\01_Work\FLink\avro-maven-master\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ avro-maven ---
[INFO] No sources to compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.932 s
[INFO] Finished at: 2015-08-10T19:16:44+05:30
[INFO] Final Memory: 6M/16M
[INFO] ------------------------------------------------------------------------
但没有生成的代码.
我强烈感到Maven是我的致命敌人,并且我将永远无法以apache项目做任何工作,因为我无法让Maven上班.也许我应该考虑回到C/C ++的更美好的世界,在该世界中,不需要Internet连接即可编译我的源代码.
I strongly feel Maven is my mortal enemy and i will never be able to do any work with apache projects just because i cannot get maven to work. perhaps i should consider going back to saner world of C/C++ where it doesnt require an internet connection to compile my source.
推荐答案
I publish a simple demo which is fully tested and 100% works https://github.com/xmeng1/avro-maven-demo. There are two important things for generating code by using the Avro
- 配置:如果要在
mvn compile
或mvn package
时生成代码,可以将配置置于执行之下. 如果要在运行目标mvn avro:scheme
时生成代码,则需要将配置直接添加到插件中. (该演示包括两种类型的配置)
方案文件的 - 名称空间,它将决定生成代码属于哪个包.
{"namespace": "com.xx.xx.demo", "name": "Foo"}
,Foo.java
将在包com.xx.xx.demo
下创建
- The configuration: if we want to generate code when
mvn compile
ormvn package
, we can put configuration under the execution. If we want to generate code when running goalmvn avro:scheme
, we need put the configuration to the plugin directly. (the demo includes two type configuration) - The namespace of the scheme file which will decide which package the generate code will belong to.
{"namespace": "com.xx.xx.demo", "name": "Foo"}
, theFoo.java
will be created under the packagecom.xx.xx.demo
这篇关于无法调用avro-maven插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!