Maven 1.x Castor Plugin

"castor:generate" not working when using J2SDK >= 1.4

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    Windows or Linux, J2SDK 1.5.0-beta1, 1.4.1 or 1.4.2 or 1.4.2_03, Maven 1.0-rc2
  • Number of attachments :
    1

Description

I have some schema files I generate Java classes from using Castor. A snippet from my maven.xml looks like:

<attainGoal name="castor:prepare-filesystem"/>
<castor:generate
schema="${maven.src.dir}/xsd/adapter.script.xsd"
package="com.piplusplus.messaging.configuration"/>

When I use JDK 1.3.1 it generates the source correctly. When using any of the newer Java versions I instead get the following obscure error:

java.lang.NoClassDefFoundError: sun/reflect/ConstructorAccessorImpl

I tried adding the "-X" and "-verbose:class" options to track the problem further and also tried debugging against with the Castor source in my path. I think I began to make some progress, but subsequently gave up. From memory it was having problems unmarshalling the "simple types" (or similar) properties file.

After much lost time I found that the problem was avoided by causing the invokation of the source generator to be done in a forked process.

This can be achieved by pretending to have a Castor properties file by adding the line "maven.castor.properties.dir=." to the "project.properties" file, which is the workaround I'm currently using.

I've also added a patch to always fork, rather than only when a Castor properties file is available.

If "someone" could take a look at what I've done and commit if appropriate I'd be appreciative. If not, then at least if I save someone's time I'd be happy too. I like Maven, but it can be difficult to debug certain problems that occur.

Activity

Hide
David Thexton added a comment -

Patch produced with "cvs diff -U3 castor/plugin.jelly" in "maven-plugins" project to always fork source generator process.

Show
David Thexton added a comment - Patch produced with "cvs diff -U3 castor/plugin.jelly" in "maven-plugins" project to always fork source generator process.

People

Vote (2)
Watch (1)

Dates

  • Created:
    Updated: