users@jaxb.java.net

Re: JAXB Maven Plugin: jaxb.index

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Sun, 26 Jun 2011 12:01:12 +0200

Hi,

please use users_at_jaxb.java.net for support requests.

> I am using the JAXB plugin to generate JAXB classes
> from XML Schemas.
>
> Currently I would like to generate the jaxb.index file too.
> I found out from the documentation that I could use
> the argument:
>
> -Xjaxbindex
>
> There is a problem though.
> Although the jaxb.index file is correctly generated
> into the:
>
> target/generated-sources/xjc/.../jaxb.index
>
> then, it is *NOT* been put into:
>
> target/classes/...
>
> So as a result, it is also *NOT* been put into the final jar
> artifact for my project.
>
> Can you help?

Obviously you have to instruct your build system to copy resources
from target/generated-sources/xjc to target/classes. The JAXB plugin
will not do it for you; compilation, resource copying etc. is the task
of your build system.


I assume you are using Maven. Add the following into your project/build element:

                <resources>
                        <resource>
                                <directory>src/main/resources</directory>
                                <excludes>
                                        <exclude>**/*.java</exclude>
                                </excludes>
                        </resource>
                        <resource>
                                <directory>target/generated-sources/xjc</directory>
                                <excludes>
                                        <exclude>**/*.java</exclude>
                                </excludes>
                        </resource>
                </resources>

Bye,
/lexi