Issue Details (XML | Word | Printable)

Key: JIBX-331
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Jerome Bernard
Reporter: Guillaume CERNIER
Votes: 2
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
JiBX

No way to customize the jibx "schema-codegen" goal in the maven-jibx-plugin 1.2.1.1

Created: 06/Oct/09 04:17 AM   Updated: 11/Mar/10 12:58 AM
Component/s: maven plugin
Affects Version/s: JiBX 1.2.1
Fix Version/s: JiBX 1.2.1

Time Tracking:
Not Specified

File Attachments: 1. Text File SchemaCodeGenMojo.java.patch (2 kB)



 Description  « Hide

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/${schema.provider}/${schema.version}/jibx.xml
</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.provider}/${schema.version}</directory>
<includes>
<include>${schema.includePattern}</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



Carsten Haustein added a comment - 14/Oct/09 02:50 PM

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.


Guillaume CERNIER added a comment - 15/Oct/09 09:59 AM

You're right Carsten.

Despite CVS access problems to the source code (even read-only anonymous access), I have created a patch fixing the 2 problems you raised :

1) I made the options like <options><key>value</key></options> to be translated into "-key value"
2) I move the block managing the <customizations> tag just after the one managing the <options> one

So that now, there are two ways to customize the schema-codegen goal and all command-line options have an equivalent in the maven configuration


Guillaume CERNIER added a comment - 15/Oct/09 10:00 AM

The patch mentioned above


Guillaume CERNIER added a comment - 15/Oct/09 10:02 AM

Maybe someone with write access to the source code can apply it ?


Guido Schmutz added a comment - 06/Jan/10 03:06 AM

any plans when this fix will be applied?