Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Static weaving question: referenced jars?

I had a look through the static weaving source code, but had to give up (not enough time).

I'm looking at doing some JPA unit testing "the right way".  Currently we do it the wrong way by explicitly disabling weaving altogether (otherwise the Big Three JPA providers crash into each other in our unit tests with their dynamic weaving/enhancement agents).

By "the right way" I mean performing static weaving (in EclipseLink's case).

As I was whacking away at the various Maven incantations to make this all happen during JUnit execution, it dawned on me: I can statically weave the *current* project's JPA classes, but what (if anything) will the weaver do about classes referenced in the persistence unit that are (a) on the classpath, and hence at least somewhat visible to the static weaver but (b) not in the (single?!) jar/directory specified as the static weaver's "source" argument?

To put it more simply: assume I'm working on a classes directory for project Fred.

Assume further that Fred has a dependency on Joe.  Joe is a project containing unweaved entity classes in a jar, and is on the classpath at the time that the static weaver is called.

If I call the weaver like this:
  java org.eclipse.persistence.tools.weaving.jpa.StaticWeave -persistenceinfo c:\wherever -classpath c:\fred\classes;c:\joe.jar c:\fred\classes c:\fred\weaved-classes
...I'm assuming it will only weave Fred's classes, not Joe's, even if Fred's persistence XML makes reference to a Joe class.

Is there a way (I don't see one) to specify multiple source jars?

(Finally, the -classpath argument, incidentally is *not* required, contrary to the documentation; obviously in such a case you'd better be invoking StaticWeave from within a Java program)

Best,
Laird

Back to the top