Well,
I seem to have got the desired results by using an <include> but I can't
seem to get it to work the way its documented.
To recap, I have two projects, lets call them Lib and Web.
Lib has some classes which are part of the XML bindings required by Web.
Lib now has a src/jibx-bindings/common-bindings-2.xml file which
contains a 'package' attribute which is where it puts the xxxxFactory class.
Web has an include statement:
<include precompiled="false"
path="classpath:/jibx-mappings/common-bindings-2.xml"/>
which seems to work and generates the required binding files in the
Web/war/WEB-INF/classes/**.* folders
When I build the jar for LIb, that has the appropriate generated classes
and the binding xml file in it.
When I build the war for Web, that includes the above.
The Jibx compile works for both projects in the CI system (of course,
adding the jar from Lib into Web's C/P - using Ivy as a dependency manager)
So, since that's what I wanted, I'm happy. The only perplexing bits are:
1. if i set precompiled="true" the Web jibx compile fails with a null
pointer exception as below:
Running binding compiler version jibx_1_2_3_SNAPSHOT
Error running binding compiler
java.lang.NullPointerException
at
org.jibx.binding.def.BindingBuilder.unmarshalPrecompiledMappings(BindingBuilder.java:1980)
at
org.jibx.binding.def.BindingBuilder.unmarshalInclude(BindingBuilder.java:2092)
at
org.jibx.binding.def.BindingBuilder.unmarshalBindingDefinition(BindingBuilder.java:2165)
at org.jibx.binding.Utility.loadBinding(Utility.java:300)
at org.jibx.binding.Utility.loadFileBinding(Utility.java:420)
....
and
2. You can set identical <namespace> elements in both files! I actually
sort of feel that that's a bug. If you set the namespace in the include,
it only applies to the included elements, but if you set it in the file
which does the include then it only affects elements bound from that file.
It would not seem unreasonable that the 'conflicting namespace' check
could identify that the namespaces are identical - or am I missing
something?
Regards
Alan
On 2/1/2012 3:33 PM, Archie Cobbs wrote:
See also http://jibx.sourceforge.net/binding/precompiled.html
I've never used pre-compiled bindings but it sounds like it might be
useful.
-AC
On Wed, Feb 1, 2012 at 5:09 PM, Alan Chaney <a...@mechnicality.com
<mailto:a...@mechnicality.com>> wrote:
Thanks Archie,
I'll think about that one...
I'm also considering the obvious solution of moving all the files
which are relevant to a given jibx binding file into the same
project - still its a pity that there isn't some kind of "deferred
binding" solution. Just wondered how other people had handled this
problem.
Regards
Alan
On 2/1/2012 2:57 PM, Archie Cobbs wrote:
One idea...
Try defining abstract bindings for everything in the library, and
then including the abstract binding files (Foo.xml, Bar.xml,
etc.) in your library JAR file. Then don't do any JiBX binding
when building the library. Only do it during the WAR build.
You'll have to extract the Foo.xml files out of the library JAR,
so you can then include them during your WAR build from your WAR
build binding files that define your concrete mappings.
-Archie
On Wed, Feb 1, 2012 at 4:27 PM, Alan Chaney
<a...@mechnicality.com <mailto:a...@mechnicality.com>> wrote:
Sorry, just noticed that the topic is wrong - it should be
"Splitting
JIBX compile across two projects"
Hi
I've been working until recently with one project which had a
set of
sources and a jibx binding file. This project was a web
application and
when preparing the war for distribution on my CI server I was
simply
running the jibx compiler with Ant and making sure that the
resulting
class files were put into the WEB-INF/classes folder.
Recently, I moved some classes which are referenced in the
jibx compile
to another project which is a library project for the first
project.
When I'm in Eclipse its fine, but when I try and build a jar
on the CI
server from the library project to be used by the web app
project of
course it fails because the generated classes aren't in the
library jar
and I can't generate them because the binding file is in the
web app
project. This works in Eclipse because the file structure is
not wrapped
into the jar.
Any suggestions on how I can split my projects such that some
of the
classes to be processed by JIBX are in a jar of one project
and the
others in a war of another project?
I should add that the reason why I've split them is that
other projects
are needing to use my library classes and including the web
app war as
part of the classpath of those other projects would be a
horrible hack.
Thanks
Alan Chaney
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft
developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5,
CSS3, MVC3,
Metro Style Apps, more. Free future releases when you
subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
<mailto:jibx-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/jibx-users
--
Archie L. Cobbs
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net <mailto:jibx-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/jibx-users
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft
developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3,
MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
<mailto:jibx-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/jibx-users
--
Archie L. Cobbs
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users