My use-case:

I build an EAR using Maven 2 and the Sun SDK 1.4.2. For testing I tend
to run a few JUnit tests from Eclipse. These tests typically invoke some
remote beans on the application server. This gives me the dreaded
InvalidClassException because the local serialVersionUID differs from
the remote serialVersionUID.

 

Evalution:

I think most of us dealing with RMI have encountered this problem
before. It is known that different compilers generate different
serialVersionUIDs for the same class. In my case the remote classes are
generated with the Sun JavaC while the local classes are generated by
Eclipse JDT.

 

Plan:

Although this problem is not actually a Maven 2 issue, I was thinking
Maven 2 could assist in the solution to the problem. The
maven-compiler-plugin has a compilerId setting which seems to indicate
it can be reconfigured to use another compiler. Would it be possible for
M2 to use the Eclipse compiler so that the artifacts will have the same
serialVersionUID as in Eclipse? If so, how would I go about this?

 

P.S.

I know I can manually add serialVersionUIDs to serializable classes, but
this is not an option as most of my serializable classes are value
objects generated by XDoclet. XDoclet does not have a way of specifying
serialVersionUID for generated value objects.

Reply via email to