JiBX

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

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major 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 :
    1

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/${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

Issue Links

Activity

Hide
Carsten Haustein added a comment -

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.

Show
Carsten Haustein added a comment - 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.
Hide
Guillaume CERNIER added a comment -

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

Show
Guillaume CERNIER added a comment - 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
Hide
Guillaume CERNIER added a comment -

The patch mentioned above

Show
Guillaume CERNIER added a comment - The patch mentioned above
Hide
Guillaume CERNIER added a comment -

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

Show
Guillaume CERNIER added a comment - Maybe someone with write access to the source code can apply it ?
Hide
Guido Schmutz added a comment -

any plans when this fix will be applied?

Show
Guido Schmutz added a comment - any plans when this fix will be applied?
Hide
Don Corley added a comment -

This patch will break the current behavior.
1. <options> are supported, just not documented. The options are listed in the (jibx.cvs.sourceforge.net /cvsroot/jibx/ core/build/src) org.jibx.schema.codegen.custom package, files NestingCustomBase.java and SchemaRootBase.java.

2. You are correct, the <customizations> tag is added in the wrong order in the SchemaCodeGenMojo file. This part of the patch needs to be applied.

Show
Don Corley added a comment - This patch will break the current behavior. 1. <options> are supported, just not documented. The options are listed in the (jibx.cvs.sourceforge.net /cvsroot/jibx/ core/build/src) org.jibx.schema.codegen.custom package, files NestingCustomBase.java and SchemaRootBase.java. 2. You are correct, the <customizations> tag is added in the wrong order in the SchemaCodeGenMojo file. This part of the patch needs to be applied.
Hide
Don Corley added a comment -

/cvsroot/jibx/maven-jibx-plugin/src/main/java/org/jibx/maven/SchemaCodeGenMojo.java,v <-- SchemaCodeGenMojo.java
new revision: 1.3; previous revision: 1.2

Show
Don Corley added a comment - /cvsroot/jibx/maven-jibx-plugin/src/main/java/org/jibx/maven/SchemaCodeGenMojo.java,v <-- SchemaCodeGenMojo.java new revision: 1.3; previous revision: 1.2
Hide
Jim Hurne added a comment -

Has the fix for this bug been released? I'm using version 1.2.2 of the Maven plugin, and I still get the "Command line options must precede all other arguments" error. Could it be a regression?

Show
Jim Hurne added a comment - Has the fix for this bug been released? I'm using version 1.2.2 of the Maven plugin, and I still get the "Command line options must precede all other arguments" error. Could it be a regression?

People

Vote (3)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: