users@jaxb.java.net

Re: Setting up a JAXB plugin development environment in Eclipse

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Thu, 1 Oct 2009 08:02:02 +0200

Hi,

> does anyone here have an easy "recipe" for setting up an environment to
> write JAXB plugins in Eclipse?

I've developed a number of JAXB plugins, using Eclipse as IDE. In
order to ease development, I also needed to develop a tools package
and a testing infrastructure. Take a look at this project:

https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/

If you're interested in a test case, see
org.jvnet.jaxb2_commons.tests.issues.RunIssuesPlugin in
tests/issues/src/test/java. It runs XJC with specified parameters:

public class RunIssuesPlugin extends RunXJC2Mojo {
        
        @Override
        protected void configureMojo(AbstractXJC2Mojo mojo) {
                super.configureMojo(mojo);
                mojo.setExtension(true);
        }

        @Override
        public List<String> getArgs() {
                final List<String> args = new ArrayList<String>(super.getArgs());
                args.add("-XtoString");
                args.add("-Xequals");
                args.add("-XhashCode");
                args.add("-Xcopyable");
                args.add("-Xmergeable");
                return args;
        }

}

This runnable as unit test from Eclipse which allows tracing/debuggin
plugins quite nicely.

Bye.
/lexi