Это скорее обмен знаниями, а не вопрос. Думаю, этот маленький фрагмент муравья может быть кому-то полезен.
<target name="create-jaxb-index" depends="compile">
<!-- Create a suitable jaxb.index file on the fly to remove the need for an ObjectFactory
jaxb.index is a simple list of the domain objects without package or extension, e.g.
org.example.Domain.java -> Domain
-->
<fileset id="domain-sources" dir="${src}">
<include name="org/example/*.java"/>
</fileset>
<pathconvert property="domain-list" refid="domain-sources" pathsep="${line.separator}">
<chainedmapper>
<flattenmapper/>
<globmapper from="*.java" to="*" casesensitive="false"/>
</chainedmapper>
</pathconvert>
<echo file="${target}/classes/org/example/jaxb.index" message="${domain-list}"/>
</target>
ОК, ОК, так что он не проходит весь путь и сохраняет все имена пакетов, чтобы можно было восстановить соответствующую файловую структуру, но этого достаточно, чтобы начать работу.
Надеюсь, это поможет.
Кроме того, вы можете просто вставить этот небольшой фрагмент (без целевого элемента) в сборку Maven, например так:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<phase>compile</phase>
<configuration>
<tasks>
<!-- Create a suitable jaxb.index file on the fly to remove the need for an ObjectFactory
jaxb.index is a simple list of the domain objects without package or extension, e.g.
org.example.Domain.java -> Domain
-->
<fileset id="domain-sources" dir="${build.sourceDirectory}">
<include name="org/example/domain/*.java"/>
</fileset>
<pathconvert property="domain-list" refid="domain-sources" pathsep="${line.separator}">
<chainedmapper>
<flattenmapper/>
<globmapper from="*.java" to="*" casesensitive="false"/>
</chainedmapper>
</pathconvert>
<echo file="${build.outputDirectory}/org/example/domain/jaxb.index" message="${domain-list}"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>