[ http://jira.codehaus.org/browse/MCOBERTURA-26?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_101458 ]
Johann Reyes commented on MCOBERTURA-26: ---------------------------------------- K. Track it down to this line: 150 // Set the instrumented classes to be the new output directory (for other plugins to pick up) 151 project.getBuild().setOutputDirectory( instrumentedDirectory.getPath() ); This is where the output directory is set to the instrumented cobertura directory. This is fine but the class now has dependencies on cobertura classes that the hibernate plugin doesn't have and so what it really happens it fails to load the class, not that it didn't find it. One workaround I found is to add this dependency to the hibernate plugin <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>hibernate3-maven-plugin</artifactId> <version>2.0-alpha-1</version> <configuration> <components> <component> <name>hbm2ddl</name> <implementation>annotationconfiguration</implementation> </component> </components> <componentProperties> <drop>true</drop> <jdk5>true</jdk5> <propertyfile>target/test-classes/jdbc.properties</propertyfile> </componentProperties> </configuration> <executions> <execution> <phase>process-test-resources</phase> <goals> <goal>hbm2ddl</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>${jdbc.groupId}</groupId> <artifactId>${jdbc.artifactId}</artifactId> <version>${jdbc.version}</version> </dependency> <dependency> <groupId>cobertura</groupId> <artifactId>cobertura</artifactId> <version>1.8</version> </dependency> </dependencies> </plugin> it let the project to keep working. So my question really is what's next? > Embedded error: org.hibernate.MappingException > ---------------------------------------------- > > Key: MCOBERTURA-26 > URL: http://jira.codehaus.org/browse/MCOBERTURA-26 > Project: Maven 2.x Cobertura Plugin > Issue Type: Bug > Environment: Maven 2.0.3 > cobertura-maven-plugin-2.0-20060331.055400-6 > surefire 2.2-SNAPSHOT > Reporter: Adrian > Priority: Critical > > My project uses hibernate and utilises the antrun plugin to execute the > hibernate tool. Below is the antrun section of my pom.xml that is in the > build section of the pom. > {code:xml} > <plugin> > <artifactId>maven-antrun-plugin</artifactId> > <executions> > <execution> > <phase>generate-test-resources</phase> > <goals> > <goal>run</goal> > </goals> > <configuration> > <tasks> > <taskdef > > classname="org.hibernate.tool.ant.HibernateToolTask" > name="hibernatetool"> > <classpath > > refid="maven.compile.classpath"> > </classpath> > <classpath > > path="${basedir}\target\classes"> > </classpath> > </taskdef> > <taskdef > > classname="org.dbunit.ant.DbUnitTask" name="dbunit"> > <classpath > > refid="maven.runtime.classpath"> > </classpath> > </taskdef> > <property > > location="${basedir}\target\schema" name="schema.dir"> > </property> > <echo>${schema.dir}</echo> > <mkdir dir="${schema.dir}"></mkdir> > <hibernatetool > destdir="${schema.dir}"> > <annotationconfiguration > > configurationfile="${basedir}\src\test\resources\hibernate.cfg.xml"> > </annotationconfiguration> > <hbm2ddl drop="true" > console="true" > create="true" > outputfilename="schema.sql"> > </hbm2ddl> > <hbm2doc></hbm2doc> > </hibernatetool> > </tasks> > </configuration> > </execution> > </executions> > </plugin> > {code} > When cobertura is run on the project : > {code} > mvn -e clean cobertura:clean cobertura:cobertura > {code} > I get the following output from maven > {noformat} > + Error stacktraces are turned on. > [INFO] Scanning for projects... > [INFO] Searching repository for plugin with prefix: 'cobertura'. > [INFO] > ---------------------------------------------------------------------------- > [INFO] Building PICS Model > [INFO] task-segment: [clean, cobertura:clean, cobertura:cobertura] > [INFO] > ---------------------------------------------------------------------------- > [INFO] [clean:clean] > [INFO] Deleting directory /home/apill/workspaces/main/pics-model/target > [INFO] Deleting directory > /home/apill/workspaces/main/pics-model/target/classes > [INFO] Deleting directory > /home/apill/workspaces/main/pics-model/target/test-classes > [INFO] [cobertura:clean {execution: default}] > [INFO] [cobertura:clean] > [INFO] Preparing cobertura:cobertura > [INFO] [resources:resources] > [INFO] Using default encoding to copy filtered resources. > [INFO] [compiler:compile] > Compiling 92 source files to > /home/apill/workspaces/main/pics-model/target/classes > [INFO] [cobertura:instrument] > [INFO] Cobertura 1.7 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file > Instrumenting 142 classes to > /home/apill/workspaces/main/pics-model/target/generated-classes/cobertura > Cobertura: Saved information on 140 classes. > Instrument time: 1393ms > [INFO] Instrumentation was successful. > [INFO] [antrun:run {execution: default}] > [INFO] Executing tasks > [echo] /home/apill/workspaces/main/pics-model/target/schema > [mkdir] Created dir: /home/apill/workspaces/main/pics-model/target/schema > [hibernatetool] Executing Hibernate Tool with a Hibernate Annotation/EJB3 > Configuration > [hibernatetool] 1. task: hbm2ddl (Generates database schema) > 2006-04-11 12:10:384 [main] INFO org.hibernate.cfg.Environment [<clinit>() > :479] - Hibernate 3.1.2 > 2006-04-11 12:10:409 [main] INFO org.hibernate.cfg.Environment [<clinit>() > :509] - hibernate.properties not found > 2006-04-11 12:10:420 [main] INFO org.hibernate.cfg.Environment [<clinit>() > :525] - using CGLIB reflection optimizer > 2006-04-11 12:10:429 [main] INFO org.hibernate.cfg.Environment [<clinit>() > :555] - using JDK 1.4 java.sql.Timestamp handling > 2006-04-11 12:10:587 [main] INFO org.hibernate.cfg.Configuration > [configure() :1342] - configuring from file: hibernate.cfg.xml > [INFO] > ------------------------------------------------------------------------ > [ERROR] BUILD ERROR > [INFO] > ------------------------------------------------------------------------ > [INFO] Error executing ant tasks > Embedded error: org.hibernate.MappingException: Unable to load class declared > as <mapping class="com.dolby.pics.model.impl.BusinessUnit"/> in the > configuration: > net.sourceforge.cobertura.coveragedata.HasBeenInstrumented > [INFO] > ------------------------------------------------------------------------ > [INFO] Trace > org.apache.maven.lifecycle.LifecycleExecutionException: Error executing ant > tasks > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:891) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:734) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:505) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:488) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:458) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140) > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322) > at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115) > at org.apache.maven.cli.MavenCli.main(MavenCli.java:256) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:615) > 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: Error executing > ant tasks > at > org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:114) > at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:83) > at > org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534) > ... 20 more > Caused by: org.hibernate.MappingException: Unable to load class declared as > <mapping class="com.dolby.pics.model.impl.BusinessUnit"/> in the > configuration: > at org.apache.tools.ant.Task.perform(Task.java:373) > at org.apache.tools.ant.Target.execute(Target.java:341) > at > org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:108) > ... 23 more > Caused by: org.hibernate.MappingException: Unable to load class declared as > <mapping class="com.dolby.pics.model.impl.BusinessUnit"/> in the > configuration: > at > org.hibernate.cfg.AnnotationConfiguration.parseMappingElement(AnnotationConfiguration.java:374) > at > org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433) > at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414) > at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390) > at org.hibernate.cfg.Configuration.configure(Configuration.java:1344) > at > org.hibernate.tool.ant.ConfigurationTask.doConfiguration(ConfigurationTask.java:108) > at > org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:55) > at > org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:179) > at > org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:43) > at > org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:143) > at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) > at org.apache.tools.ant.Task.perform(Task.java:364) > ... 25 more > Caused by: java.lang.NoClassDefFoundError: > net.sourceforge.cobertura.coveragedata.HasBeenInstrumented > at java.lang.ClassLoader.defineClassImpl(Native Method) > at java.lang.ClassLoader.defineClass(ClassLoader.java:218) > at > org.apache.tools.ant.loader.AntClassLoader2.defineClassFromData(AntClassLoader2.java:76) > at > org.apache.tools.ant.AntClassLoader.getClassFromStream(AntClassLoader.java:1090) > at > org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1154) > at > org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1107) > at > org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:977) > at java.lang.ClassLoader.loadClass(ClassLoader.java:517) > at > org.apache.tools.ant.AntClassLoader.findBaseClass(AntClassLoader.java:1197) > at > org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:973) > at java.lang.ClassLoader.loadClass(ClassLoader.java:517) > at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:101) > at > org.hibernate.cfg.AnnotationConfiguration.parseMappingElement(AnnotationConfiguration.java:366) > ... 36 more > [INFO] > ------------------------------------------------------------------------ > [INFO] Total time: 18 seconds > [INFO] Finished at: Tue Apr 11 12:10:49 BST 2006 > [INFO] Final Memory: 11M/36M > [INFO] > ------------------------------------------------------------------------ > {noformat} -- 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