openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sudhakar <sudha...@co.brazos.tx.us>
Subject Re: how to get maven openjpa plugin to enhance
Date Tue, 28 Aug 2007 22:10:25 GMT
I've found something that is causing my build to fail but it doesn't
make sense.

I re-created a new maven project from scratch and migrated my code few
classes at a time to the new project. I've identified at least two
instances where the mvn build fails with the same error message. This is
simply by added a new class to the project. If anyone is interested,
please email me directly and I can send you the project and you can try
it as well.

Thanks
-sud




ben short wrote:
> Ok heres my setup, as I said I only got this far lastnight so by no
> means is it 100% correct..
>
> pom.xml
>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
>     <modelVersion>4.0.0</modelVersion>
>     <groupId>com.daisytechnologies.jpatest</groupId>
>     <artifactId>jpa-test</artifactId>
>     <packaging>jar</packaging>
>     <version>1.0-SNAPSHOT</version>
>     <name>jpa-test</name>
>     <url>http://maven.apache.org</url>
>     <dependencies>
>         <dependency>
>             <groupId>junit</groupId>
>             <artifactId>junit</artifactId>
>             <version>3.8.1</version>
>             <scope>test</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.openjpa</groupId>
>             <artifactId>openjpa-all</artifactId>
>             <version>0.9.6-incubating</version>
>         </dependency>
>         <dependency>
>             <groupId>org.springframework</groupId>
>             <artifactId>spring</artifactId>
>             <version>2.0.6</version>
>             <scope>compile</scope>
>         </dependency>
>         <dependency>
>             <groupId>postgresql</groupId>
>             <artifactId>postgresql</artifactId>
>             <version>8.2-504.jdbc3</version>
>             <scope>compile</scope>
>         </dependency>
>     </dependencies>  <!--
>     <repositories>
>         <repository>
>             <id>apache-snapshots</id>
>             <url>http://people.apache.org/repo/m2-incubating-repository</url>
>         </repository>
>     </repositories>   -->
>     <build>
>         <plugins>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-compiler-plugin</artifactId>
>                 <configuration>
>                     <source>1.5</source>
>                     <target>1.5</target>
>                 </configuration>
>             </plugin>
>             <plugin>
>                 <groupId>org.codehaus.mojo</groupId>
>                 <artifactId>openjpa-maven-plugin</artifactId>
>                 <executions>
>                     <execution>
>                         <phase>process-classes</phase>
>                         <goals>
>                             <goal>enhance</goal>
>                         </goals>
>                         <configuration>
>                             <!-- Pass properties to the Plugin here -->
>                             <toolProperties>
>                                 <property>
>                                     <name>addDefaultConstructor</name>
>                                     <value>true</value>
>                                 </property>
>                                 <property>
>                                     <name>enforcePropertyRestrictions</name>
>                                     <value>true</value>
>                                 </property>
>                             </toolProperties>
>                         </configuration>
>                     </execution>
>                 </executions>
>             </plugin>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-surefire-plugin</artifactId>
>                 <configuration>
>                     <includes>
>                         <include>com/daisytechnologies/**/*Tests.class</include>
>                     </includes>
>                 </configuration>
>             </plugin>
>         </plugins>
>     </build>
> </project>
>
> And my persistance.xml which is in src/main/resources/META-INF
>
> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
> 		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 		xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
> 		version="1.0">
>
>     <persistence-unit name="openjpa">
>     <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>         <class>com.daisytechnologies.jpatest.Product</class>
>         <class>com.daisytechnologies.jpatest.ProductInstance</class>
>         <class>com.daisytechnologies.jpatest.AttributeAndValue</class>
>     <properties>
>       <property name="openjpa.ConnectionURL"
> value="jdbc:postgresql://192.168.100.32/jpa"/>
>       <property name="openjpa.ConnectionDriverName"
> value="org.postgresql.jdbc3.Jdbc3PoolingDataSource"/>
>       <property name="openjpa.ConnectionUserName" value="jpa"/>
>       <property name="openjpa.ConnectionPassword" value="jpa"/>
>       <property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO"/>
>     </properties>
>   </persistence-unit>
>
> </persistence>
>
> and orm.xml also in src/main/resources/META-INF
>
> <?xml version="1.0" encoding="UTF-8"?>
> <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
> 		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 		xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
> http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
> 		version="1.0">
>
>     <persistence-unit-metadata>
> 		<xml-mapping-metadata-complete/>
> 		<persistence-unit-defaults>
> 			<access>PROPERTY</access>
> 		</persistence-unit-defaults>
> 	</persistence-unit-metadata>
>
> </entity-mappings>
>
> Running mvn process-classes produces the following output...
>
> [INFO] Scanning for projects...
> [INFO] ----------------------------------------------------------------------------
> [INFO] Building jpa-test
> [INFO]    task-segment: [process-classes]
> [INFO] ----------------------------------------------------------------------------
> [INFO] [resources:resources]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [compiler:compile]
> [INFO] Compiling 2 source files to C:\Documents and Settings\Ben\My
> Documents\Programming\Projects\jpa-test\target\classes
> [INFO] [openjpa:enhance {execution: default}]
> [INFO]
> [ERROR] --------------------
> [ERROR]  Standard error from the OpenJPA Enhancer tool:
> [ERROR] --------------------
> [ERROR] 47  INFO   [main] openjpa.Tool - Enhancer running on type
> "class com.daisytechnologies.jpatest.Product".
> 203  INFO   [main] openjpa.Tool - The class is already persistence
> capable - no enhancement performed.
> 203  INFO   [main] openjpa.Tool - Enhancer running on type "class
> com.daisytechnologies.jpatest.Main".
> 203  WARN   [main] openjpa.Enhance - Type "class
> com.daisytechnologies.jpatest.Main" has no metadata; enhancing as
> persistence aware. If you intended for "class
> com.daisytechnologies.jpatest.Main" to be persistence-capable, then
> this means that OpenJPA could not find any metadata for "class
> com.daisytechnologies.jpatest.Main". This can happen if the directory
> containing your metadata is not in your CLASSPATH, or if your metadata
> files are not named properly. See the documentation on metadata
> placement for more information.
> 203  INFO   [main] openjpa.Tool - The class does not have metadata -
> enhanced as persistence-aware.
> 219  INFO   [main] openjpa.Tool - Enhancer running on type "class
> com.daisytechnologies.jpatest.AttributeAndValue".
> 250  INFO   [main] openjpa.Tool - Enhancer running on type "class
> com.daisytechnologies.jpatest.Main$1".
> 250  WARN   [main] openjpa.Enhance - Type "class
> com.daisytechnologies.jpatest.Main$1" has no metadata; enhancing as
> persistence aware. If you intended for "class
> com.daisytechnologies.jpatest.Main$1" to be persistence-capable, then
> this means that OpenJPA could not find any metadata for "class
> com.daisytechnologies.jpatest.Main$1". This can happen if the
> directory containing your metadata is not in your CLASSPATH, or if
> your metadata files are not named properly. See the documentation on
> metadata placement for more information.
> 266  INFO   [main] openjpa.Tool - The class does not have metadata -
> enhanced as persistence-aware.
> 266  INFO   [main] openjpa.Tool - Enhancer running on type "class
> com.daisytechnologies.jpatest.ProductInstance".
>
> [ERROR] --------------------
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESSFUL
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 3 seconds
> [INFO] Finished at: Tue Aug 28 17:08:37 BST 2007
> [INFO] Final Memory: 6M/12M
> [INFO] ------------------------------------------------------------------------
>
>
> On 8/28/07, Patrick Linskey <plinskey@gmail.com> wrote:
>   
>> Hi,
>>
>> What do you see if you set the openjpa.Log system property to
>> DefaultLevel=TRACE?
>>
>> I'm not a maven expert, but I imagine that you could do this like so:
>>
>> mvn -Dopenjpa.Log=DefaultLevel=TRACE package
>>
>> -Patrick
>>
>> On 8/27/07, sudhakar <sudhakar@co.brazos.tx.us> wrote:
>>     
>>> I have the following in my maven JPA project's pom.xml. But when I run
>>> "mvn clean package" I get an error message as follows. I am following
>>> the instructions here
>>>
>>> http://bill.dudney.net/roller/bill/entry/20070424
>>>
>>> I am using the 1.0.0-SNAPSHOT version of OpenJPA. I'd appreciate any
>>> help troubleshooting this.
>>> Thanks
>>>
>>>
>>> [INFO] [openjpa:enhance {execution: JPA Enhance}]
>>> [INFO]
>>> [INFO]
>>> ------------------------------------------------------------------------
>>> [ERROR] BUILD ERROR
>>> [INFO]
>>> ------------------------------------------------------------------------
>>> [INFO] The OpenJPA Enhancer tool exited with a non-null exit code.
>>> [INFO]
>>> ------------------------------------------------------------------------
>>> [INFO] Trace
>>> org.apache.maven.lifecycle.LifecycleExecutionException: The OpenJPA
>>> Enhancer too
>>> l exited with a non-null exit code.
>>>         at
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
>>> ultLifecycleExecutor.java:564)
>>>         at
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
>>> fecycle(DefaultLifecycleExecutor.java:480)
>>>         at
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
>>> ltLifecycleExecutor.java:459)
>>>         at
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
>>> dleFailures(DefaultLifecycleExecutor.java:311)
>>>         at
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
>>> ts(DefaultLifecycleExecutor.java:278)
>>>         at
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
>>> fecycleExecutor.java:143)
>>>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
>>>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
>>>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>         at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
>>> java:39)
>>>         at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
>>> sorImpl.java:25)
>>>         at java.lang.reflect.Method.invoke(Method.java:597)
>>>         at
>>> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>>>         at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>>>         at
>>> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>>>
>>>         at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>>> Caused by: org.apache.maven.plugin.MojoExecutionException: The OpenJPA
>>> Enhancer
>>> tool exited with a non-null exit code.
>>>         at
>>> org.codehaus.mojo.openjpa.OpenJpaEnhancerMojo.enhance(OpenJpaEnhancer
>>> Mojo.java:248)
>>>         at
>>> org.codehaus.mojo.openjpa.OpenJpaEnhancerMojo.execute(OpenJpaEnhancer
>>> Mojo.java:105)
>>>         at
>>> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
>>> nManager.java:443)
>>>         at
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
>>> ultLifecycleExecutor.java:539)
>>>         ... 16 more
>>> [INFO]
>>> ------------------------------------------------------------------------
>>> [INFO] Total time: 10 seconds
>>> [INFO] Finished at: Mon Aug 27 16:59:12 CDT 2007
>>> [INFO] Final Memory: 8M/19M
>>> [INFO]
>>> ------------------------------------------------------------------------
>>>
>>>
>>>
>>>
>>>
>>> My pom.xml
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <project xmlns="http://maven.apache.org/POM/4.0.0"
>>>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>>> http://maven.apache.org/maven-v4_0_0.xsd">
>>>     <modelVersion>4.0.0</modelVersion>
>>>     <groupId>brazos.voter</groupId>
>>>     <artifactId>brazos.voter.lib</artifactId>
>>>     <version>1.0.0</version>
>>>     <build>
>>>         <plugins>
>>>             <plugin>
>>>                 <groupId>org.codehaus.mojo</groupId>
>>>                 <artifactId>openjpa-maven-plugin</artifactId>
>>>                 <executions>
>>>                     <execution>
>>>                         <id>JPA Enhance</id>
>>>                         <phase>process-classes</phase>
>>>                         <goals>
>>>                             <goal>enhance</goal>
>>>                         </goals>
>>>                     </execution>
>>>                 </executions>
>>>                 <configuration>
>>>                     <toolProperties>
>>>                         <property>
>>>                             <name>addDefaultConstructor</name>
>>>                             <value>false</value>
>>>                         </property>
>>>                         <property>
>>>                             <name>enforcePropertyRestrictions</name>
>>>                             <value>true</value>
>>>                         </property>
>>>                     </toolProperties>
>>>                 </configuration>
>>>             </plugin>
>>>             <plugin>
>>>                 <artifactId>maven-compiler-plugin</artifactId>
>>>                 <configuration>
>>>                     <source>1.6</source>
>>>                     <target>1.6</target>
>>>                     <encoding>iso-8859-1</encoding>
>>>                 </configuration>
>>>             </plugin>
>>>             <plugin>
>>>                 <artifactId>maven-surefire-plugin</artifactId>
>>>                 <version>2.2</version>
>>>                 <configuration>
>>>                     <suiteXmlFiles>
>>>                         <suiteXmlFile>
>>>                             src/test/resources/testng.xml
>>>                         </suiteXmlFile>
>>>                     </suiteXmlFiles>
>>>                 </configuration>
>>>             </plugin>
>>>             <plugin>
>>>                 <artifactId>maven-jar-plugin</artifactId>
>>>                 <configuration>
>>>                     <archive>
>>>                         <manifest>
>>>                             <addClasspath>true</addClasspath>
>>>                         </manifest>
>>>                     </archive>
>>>                 </configuration>
>>>             </plugin>
>>>         </plugins>
>>>     </build>
>>>     <repositories>
>>>         <repository>
>>>             <id>Ibiblio</id>
>>>             <name>Ibiblio</name>
>>>             <url>http://www.ibiblio.org/maven</url>
>>>         </repository>
>>>         <repository>
>>>             <id>java.net</id>
>>>             <url>
>>>                 https://maven-repository.dev.java.net/nonav/repository
>>>             </url>
>>>             <layout>legacy</layout>
>>>         </repository>
>>>         <repository>
>>>             <id>java.net 2</id>
>>>             <url>http://download.java.net/maven/2</url>
>>>         </repository>
>>>         <repository>
>>>             <id>apache-snapshots2</id>
>>>             <url>
>>>                 http://people.apache.org/repo/m2-snapshot-repository/
>>>             </url>
>>>         </repository>
>>>     <dependencies>
>>>         <dependency>
>>>             <groupId>org.testng</groupId>
>>>             <artifactId>testng</artifactId>
>>>             <version>5.1</version>
>>>             <classifier>jdk15</classifier>
>>>             <scope>test</scope>
>>>         </dependency>
>>>         <dependency>
>>>             <groupId>log4j</groupId>
>>>             <artifactId>log4j</artifactId>
>>>             <version>1.2.13</version>
>>>         </dependency>
>>>         <dependency>
>>>             <groupId>dbunit</groupId>
>>>             <artifactId>dbunit</artifactId>
>>>             <version>2.2</version>
>>>         </dependency>
>>>         <dependency>
>>>             <groupId>javax.persistence</groupId>
>>>             <artifactId>persistence-api</artifactId>
>>>             <version>1.0</version>
>>>         </dependency>
>>>         <dependency>
>>>             <groupId>javax.ejb</groupId>
>>>             <artifactId>ejb-api</artifactId>
>>>             <version>3.0</version>
>>>         </dependency>
>>>         <dependency>
>>>             <groupId>javax.transaction</groupId>
>>>             <artifactId>jta</artifactId>
>>>             <version>1.0.1B</version>
>>>         </dependency>
>>>         <dependency>
>>>             <groupId>org.apache.derby</groupId>
>>>             <artifactId>derby</artifactId>
>>>             <version>10.2.2.0</version>
>>>         </dependency>
>>>         <dependency>
>>>             <groupId>org.apache.openjpa</groupId>
>>>             <artifactId>openjpa</artifactId>
>>>             <version>1.0.0-SNAPSHOT</version>
>>>         </dependency>
>>>     </dependencies>
>>> </project>
>>>
>>>
>>> --
>>> ---------------------------
>>> Senior Systems Analyst
>>> Brazos County IT Department
>>> http://www.co.brazos.tx.us
>>> Ph No: 979-361-4688
>>>
>>>
>>>       
>> --
>> Patrick Linskey
>> 202 669 5907
>>
>>     

Mime
View raw message