Adam, 

If I understood your problem correct, then you have a

.) module A which contains @Entities in src/test/java
.) module B which also has @Entities in src/test/java and rely on the @Entities 
from module A

Is this the scenario you have?

If so, you need to tell module A that it should package and add the test-jar as 
attached artifact. Simply add this to the pom.xml of module A:

>    <plugin>
>        <artifactId>maven-jar-plugin</artifactId>
>        <executions>
>            <execution>
>                <goals>
>                    <goal>test-jar</goal>
>                </goals>
>            </execution>
>        </executions>
>    </plugin>

after a 
$> mvn clean install
you can add the dependency to the test sources jar in the pom.xml of module B.) 
:

>    <dependency>
>        <groupId>org.apache.projectX</groupId>
>        <artifactId>moduleA</artifactId>
>        <version>1.0-SNAPSHOT</version>
>        <classifier>tests</classifier>
>    </dependency>


LieGrue,
strub



--- Adam Hardy <[email protected]> schrieb am Mi, 4.3.2009:

> Von: Adam Hardy <[email protected]>
> Betreff: OpenJPA Maven Plugin
> An: [email protected]
> Datum: Mittwoch, 4. März 2009, 12:00
> I now use the openjpa-maven-plugin to
> enhance my persistence-enabled classes, but I have a couple
> of projects which rely on a superclass, which needs
> enhancing and testing.
> 
> I put this in a seperate project and wrote some unit tests
> for it, which needed a few real entity beans to demonstrate
> parent-child relationships etc. So I coded up a couple of
> entity beans for testing only, in this project.
> 
> I don't want these test-only entity beans in my jar, so I
> put them in the src/test/java directory, and this caused me
> some confusion when configuring openjpa-maven-plugin.
> 
> I have a couple of issues getting this to work. From debug
> logging, i can see that openjpa-maven-plugin is not
> including the test directory in the classpath, despite this
> config:
> 
> <execution>
>   <phase>process-test-classes</phase>
>   <id>enhanceTestEntities</id>
>   <goals>
>     <goal>enhance</goal>
>   </goals>
>   <configuration>
>     <classes>
>      
> ${build.testOutputDirectory}/org/permacode/atomic/domain/entity
>     </classes>
>    
> <outputDirectory>${build.testOutputDirectory}</outputDirectory>
>     <toolProperties>
>       <property>
>        
> <name>properties</name>
>         <value>
>          
> ${build.testOutputDirectory}/META-INF/persistence.xml#OpenJpaTest
>         </value>
>       </property>
>     </toolProperties>
>   </configuration>
> </execution>
> 
> So it fails with a ClassNotFoundException - is there
> anything I can configure to get the test dir into the
> classpath?
> 
> Thanks
> Adam
> 



Reply via email to