Maven won't let me override that annotation in my execution config then?

Mark Struberg on 04/03/09 16:45, wrote:
Humm this is because the OpenJpaEnhancerMojo has

@requiresDependencyResolution compile

LieGrue,
strub

--- Adam Hardy <adam....@cyberspaceroad.com> schrieb am Mi, 4.3.2009:

Von: Adam Hardy <adam....@cyberspaceroad.com>
Betreff: Re: OpenJPA Maven Plugin
An: users@openjpa.apache.org
Datum: Mittwoch, 4. März 2009, 17:36
Hi Mark,

not quite.

I have module A with one Entity in src/main/java and
several test entities which extend it (to allow testing) in
src/test/java.

I have moduleB which relies on moduleA non-test normal jar.
I don't need the test entities outside moduleA.

Therefore I created 2 executions - one for the main Entity
and one for the test entities.

openjpa-maven-plugin is not including the test directory in
the classpath.  This is the execution for the test
entities (the other works fine):

<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>

and it fails with a ClassNotFoundException because of the
classpath omission of target/test-classes.



Mark Struberg on 04/03/09 15:24, wrote:
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>

Reply via email to