Zachary Gramana created CAMEL-16670:
---------------------------------------
Summary: 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: Improvement
Components: camel-package-maven-plugin
Affects Versions: 3.10.0
Reporter: Zachary Gramana
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 `<plugins>`:
{code:java}
// code placeholder
<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 right-angle-brackets avoids the problem. For example, the
following `test.json` contents enables a successful build:
{code:java}
{ "fizz": "buzz" }{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)