Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JiBX 1.2.1
-
Fix Version/s: JiBX 1.2.1
-
Component/s: maven plugin
-
Labels:None
-
Number of attachments :
Description
It seems that it's currently impossible to customize the code generation feature as documented in the maven-jibx-plugin (schema-codegen goal).
When trying with the <customizations> tag as following (for example) :
----------------------------------------------------------------------------------------------------------------------------------
<configuration>
<customizations>
<path>
../generation-config/$
</path>
</customizations>
<directory>../generation-schemas/${schema.provider}
/$
{schema.version}</directory><includes>
<include>${schema.includePattern}</include>
</includes>
<verbose>true</verbose>
</configuration>
----------------------------------------------------------------------------------------------------------------------------------
we get the following error :
----------------------------------------------------------------------------------------------------------------------------------
Command line options must precede all other arguments: error on '-c'
Usage: java org.jibx.schema.codegen.CodeGen [options] schema1 schema2 ...
where options are:
-c path input customizations file
-d file for dumping the generated class structure
-n pack default package for no-namespace schema definitions
-p pack default package for all schema definitions
-s schema root directory path
-t path target directory for generated output (default is current directory)
-v verbose output flag
-w wipe all existing files from generation directory (ignored if current
directory)
The schema# files are different schemas to be included in the generation
(references from these schemas will also be included).
Terminating due to command line or customization errors
----------------------------------------------------------------------------------------------------------------------------------
and by the <options> tag (which is supposed to manage the same options as the CLI ones, e.g. -c -d -n -p ....) :
----------------------------------------------------------------------------------------------------------------------------------
<configuration>
<options>
<c>../generation-config/${schema.provider}/${schema.version}
/jibx.xml</c>
</options>
<directory>../generation-schemas/$
/$
{schema.version}</directory>
<includes>
<include>$
</include>
</includes>
<verbose>true</verbose>
</configuration>
----------------------------------------------------------------------------------------------------------------------------------
we get this one :
----------------------------------------------------------------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Parameter c not found
----------------------------------------------------------------------------------------------------------------------------------
and have no idea of which parameter tags are allowed as child of the <options> tag
Looking at the plugin code there are two issues:
1.) <options><option>value</option></options> is actually translated into "--option=value" which I don't think is supported at all. ??? It would be nice to have this working since not all command line options have an equivalent configuration parameter.
2.) Customizations are added last to the list of command line arguments (lines 149-155). This block should probably just move a few lines to make this work.