Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
319 views
in Technique[技术] by (71.8m points)

java - How ro use camel-package-maven-plugin 3.7.0 for TypeConverters

Hy,

I'm currently updating my custom camel components to camel version 3.7.0
Because it now seems to be necessary to make TypeConverters discoverable by the camelContext, I also added the camel-package-maven-plugin to generate the TypeConverterBulkLoader.

Now I have the problem, that the plugin crashes when I run it in a module, that also has a custom camel component:
Error generating data org.apache.maven.plugin.MojoFailureException: Unable to create mojo: Could not find component java type -> [Help 1]

It seems like this is an error when implementing a custom language and not specifying the javaType for that, but I only have a custom component (including endpoints/producers/consumers) and custom TypeConverters.

Can somebody tell me how to correctly use the plugin or alternatively how to implement custom TypeConverters so they are picked up by the camelContext without using the plugin?

Greets Chris

Edit:
The same error happens when I use the camel-component-maven-plugin instead of the package plugin

question from:https://stackoverflow.com/questions/65885223/how-ro-use-camel-package-maven-plugin-3-7-0-for-typeconverters

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

So I figured out what to do.

I now use the camel-component-maven-plugin as documented here: https://camel.apache.org/manual/latest/camel-component-maven-plugin.html

In addition I had to make sure to add all the annotations, that seem to be required now (if they were already mandatory in camel 2.x, then I was not aware of that).
I especially needed to add @UriParams to the endpoint configuration class itself (not only the variable in the endpoint).
Additionally I had to add @Component("name") to the component class.

All this is documented on this page and other links on that page:
https://camel.apache.org/manual/latest/writing-components.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...