[ 
https://issues.apache.org/jira/browse/CAMEL-16670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17353674#comment-17353674
 ] 

Claus Ibsen commented on CAMEL-16670:
-------------------------------------

What are you trying to do?

And for Camel end users you should use camel-component-maven-plugin
https://github.com/apache/camel/blob/main/tooling/maven/camel-component-maven-plugin/src/main/java/org/apache/camel/maven/component/GenerateComponentMojo.java#L39

Not that you report about as its ONLY for the Camel projects itself.

> Camel Package Maven Plugin fails on some JSON resource files
> ------------------------------------------------------------
>
>                 Key: CAMEL-16670
>                 URL: https://issues.apache.org/jira/browse/CAMEL-16670
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-package-maven-plugin
>    Affects Versions: 3.10.0
>            Reporter: Zachary Gramana
>            Priority: Minor
>
> *Given:*
>  * Create a new route project using spring-boot archetype
>  * Create `src/main/resources/test.json` with contents:
> {code:java}
> [{ "fizz": "buzz" }]{code}
>  * Add the following XML to the `<plugins>` node in `pom.xml`:
> {code:java}
> <plugin>
>   <groupId>org.apache.camel</groupId>
>   <artifactId>camel-package-maven-plugin</artifactId>
>   <version>3.10.0</version>
>   <executions>
>     <execution>
>       <id>generate</id>
>       <goals>
>         <goal>generate-component</goal>
>       </goals>
>       <phase>process-classes</phase>
>     </execution>
>   </executions>
> </plugin>
> {code}
>  * Run `mvn package`
> *Expected:*
> {code:java}
> [INFO] BUILD SUCCESS{code}
> *Observed:*
> {code:java}
> [INFO] BUILD FAILURE
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time: 3.852 s
> [INFO] Finished at: 2021-05-28T12:34:00-07:00
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal 
> org.apache.camel:camel-package-maven-plugin:3.10.0:generate-component 
> (generate) on project CommandInvocationRoute: Error generating data 
> org.apache.maven.plugin.MojoFailureException: Unable to create mojo: class 
> org.apache.camel.util.json.JsonArray cannot be cast to class 
> org.apache.camel.util.json.JsonObject (org.apache.camel.util.json.JsonArray 
> and org.apache.camel.util.json.JsonObject are in unnamed module of loader 
> org.codehaus.plexus.classworlds.realm.ClassRealm @7d3fb0ef) -> [Help 1]{code}
> *Notes:*
> Removing the square brackets avoids the problem. For example, the following 
> `test.json` contents enables a successful build:
> {code:java}
> { "fizz": "buzz" }
> {code}
> In addition, renaming the file to `test.txt` avoids the problem.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to