Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to execute goal org.apache.camel:camel-maven-plugin:2.11.0:run MojoExecutionException

I created a small OSGi Maven project using Eclipse Juno with an archetype camel-achetype-blueprint.

I get the following error when I (right-click) Project -> Run As -> Maven Builds and in the goal camel:run -e -X.

I know my camel route in my blueprint.xml is correct as I have tested it with a JUnit test and it runs.

I don't understand whey camel:run would not work. From the Apache Camel documentation, it should work perfectly under Eclipse run as Maven.

My pom.xml file has the following

<plugin>
   <groupId>org.apache.camel</groupId>
   <artifactId>camel-maven-plugin</artifactId>
   <version>2.11.0</version>
   <configurtion>
       <useBlueprint>true</useBlueprint>
       <logClasspath>true</logClasspath>
   </configuration>
</plugin>
<plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>build-helper-maven-plugin</artifactId>
   <version>1.8</version>
</plugin>

There error I get is the following:

[ERROR] Failed to execute goal org.apache.camel:camel-maven-plugin:2.11.0:run (default-cli) on project transport: null: MojoExecutionException: InvocationTargetException: Gave up waiting for service (objectClass=org.apache.camel.CamelContext) -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.camel:camel-maven-plugin:2.11.0:run (default-cli) on project transport: null

Any ideas?

like image 916
user3353266 Avatar asked Feb 20 '26 11:02

user3353266


1 Answers

Run the mvn install command before execute camel:run. If you prefer execute both together: mvn install camel:run.

What is happening is that the plugin is trying to find the blueprint.xml file in the target folder. If this file was not found, you got an error getting the CamelContext (OsgiDefaultCamelContext). The mvn install comand resolve this populating the target folder.

I test this here and got the same error. The only difference is that I was using maven in shell (not in Eclipse like you).

Cheers

like image 54
Ulisses Telemaco Avatar answered Feb 22 '26 00:02

Ulisses Telemaco