Tool properties not passed to PCEnhancer.run() properly
-------------------------------------------------------
Key: MOJO-1309
URL: http://jira.codehaus.org/browse/MOJO-1309
Project: Mojo
Issue Type: Bug
Components: openjpa
Environment: Maven 2.0.9, openjpa-maven-plugin 1.0
Reporter: Randy Watler
Attachments: openjpa-maven-plugin-properties.patch
Options passed to PCEnhancer.run() are constructed with toolProperties as the
default values. However, this make those properties immutable since they are
not actually part of the Options properties. While the PCEnhancer configuration
is constructed, the 'properties' property is normally removed from the Options
to prevent multiple provider setups. Unfortunately, this logic fails and the
PCEnhancer initialization ends up throwing various exceptions, (normally
MissingResourceException). The attached patch for OpenJpaEnhancerMojo.java
corrects this by constructing the Options instance without defaults and puts
specified toolProperties into it using Options.putAll().
Here is an example plugin configuration one can use to recreate the problem and
test the patch:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<includes>com/my/entities/*.class</includes>
<addDefaultConstructor>true</addDefaultConstructor>
<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
<toolProperties>
<property>
<name>properties</name>
<value>${basedir}/src/main/resources/META-INF/persistence.xml</value>
</property>
</toolProperties>
</configuration>
<executions>
<execution>
<id>jpa-enhancer</id>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<!-- force JPA version for plugin -->
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>1.2.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
See OpenJPA's Configurations.populateConfiguration() for an example of where
Options properties are removed.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email