How to create a jaxb.index file on the fly using Ant (or Maven) -
Instead of asking this question more is to share knowledge. Thought that this little ant snippet could be useful for anyone.
& lt; Target name = "make-jaxb-index" dependent = "compile" & gt; & Lt ;! - To remove the requirement of an objectfactor jaxb.index, create a suitable jaxb.index file on the fly, without a package or extension, is a simple list of domain objects, e.g. Org.example.Domain.java - & gt; Domain - & gt; & Lt; Fileset id = "domain-source" dir = "$ {src}" & gt; & Lt; Include name = "org / example / * .java" /> & Lt; / Fileset & gt; & Lt; Pathconvert property = "domain-list" refid = "domain-sources" pathsep = "$ {line.separator}" & gt; & Lt; Chainedmapper & gt; & Lt; Flattenmapper / & gt; & Lt; = "*" From globmapper = "* .java" casesinactive = "wrong" /> & Lt; / Chainedmapper & gt; & Lt; / Pathconvert & gt; & Lt; Echo file = "$ {target} / class / mail / example / jaxb.index" message = "$ {domain-list}" /> & Lt; / Target & gt; OK, okay, it does not go completely and stores all package names so that it can rebuild the appropriate file structure, but you are enough to get started. . / P> Hope this will be helpful.
In addition, you can add this short snippet (lower target element) to the Maven Build such as:
& lt; Plugin & gt; & Lt; ArtifactId & gt; Maven-antrun-plugin & lt; / ArtifactId> & Lt; Version & gt; 1.3 & lt; / Edition & gt; & Lt; Hanging & gt; & Lt; Execution & gt; & Lt; Step & gt; Collection & lt; / Step & gt; & Lt; Configuration & gt; & Lt; Functions & gt; & Lt ;! - To remove the requirement of an objectfactor jaxb.index, create a suitable jaxb.index file on the fly, without a package or extension, is a simple list of domain objects, e.g. Org.example.Domain.java - & gt; Domain - & gt; & Lt; Fileset id = "domain-source" dir = "$ {build.sourceDirectory}" & gt; & Lt; Include name = "org / example / domain / * .java" /> & Lt; / Fileset & gt; & Lt; Pathconvert property = "domain-list" refid = "domain-sources" pathsep = "$ {line.separator}" & gt; & Lt; Chainedmapper & gt; & Lt; Flattenmapper / & gt; & Lt; = "*" From globmapper = "* .java" casesinactive = "wrong" /> & Lt; / Chainedmapper & gt; & Lt; / Pathconvert & gt; & Lt; Echo file = "$ {build.outputDirectory} /org/example/domain/jaxb.index" message = "$ {domain-list}" /> & Lt; / Functions & gt; & Lt; / Configuration & gt; & Lt; Goals & gt; & Lt; Goal & gt; Run & lt; / Target & gt; & Lt; / Targets & gt; & Lt; / Execution & gt; & Lt; / Hanging & gt; & Lt; / Plugin & gt;
You can also use it.
Comments
Post a Comment