users@jaxb.java.net

Re: maven-jaxb1-plugin - run xjc for test sources

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Tue, 28 Nov 2006 10:44:23 +0100

Hi.

> Is there support for using the maven-jaxb1-plugin to generate test
> sources instead of normal ones (i.e. have them compile to test-classes
> instead of classes)? I can certainly attach it to the
> generate-test-sources phase, but I don't want it all in the final jar.
> If there isn't, a boolean parameter seems like it would work.

Do I get it correctly that you want the generated sources in
testCompileSourceRoot but not in compileSourceRoot?

So instead of current:

// Mark XJC_generated java files for compilation.
if (getProject() != null)
        getProject().addCompileSourceRoot(getGenerateDirectory().getPath());


You'd like something like:

if (getProject() != null)
{
        if (isMainSources())
                getProject().addCompileSourceRoot(getGenerateDirectory().getPath());

        if (isTestSources())
                getProject().addTestCompileSourceRoot(getGenerateDirectory().getPath());
}

Currently there is not such setting, but it is definitely doable. Please log an
issue on maven-jaxb1-plugin and I'll deal with it in the evening.

Bye.
/lexi