DataNucleus Maven增强器插件错误 - 找不到类

时间:2014-11-19 11:45:45

标签: java maven classpath datanucleus

我正在从Maven运行DataNucleus Enhancer插件

        <plugin>
            <groupId>org.datanucleus</groupId>
            <artifactId>datanucleus-maven-plugin</artifactId>
            <version>${datanucleus.maven.plugin.version}</version>
            <configuration>
                <log4jConfiguration>${project.build.outputDirectory}/log4j.properties</log4jConfiguration>
                <verbose>true</verbose>
                <enhancerName>ASM</enhancerName>
                <api>JPA</api>
                <fork>false</fork>
                <metadataIncludes>com/mydomain/*.class</metadataIncludes>
                <generateConstructor>true</generateConstructor>
            </configuration>
            <executions>
                <execution>
                    <phase>process-classes</phase>
                    <goals>
                        <goal>enhance</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

但是在运行mvn process-classes -X

时出现此错误
[DEBUG] Configuring mojo org.datanucleus:datanucleus-maven-plugin:4.0.0-release:enhance from plugin realm ClassRealm[plugin>org.datanucleus:datanucleus-maven-plugin:4.0.0-release, parent: sun.misc.Launcher$AppClassLoader@5dcba031]
[DEBUG] Configuring mojo 'org.datanucleus:datanucleus-maven-plugin:4.0.0-release:enhance' with basic configurator -->
[DEBUG]   (f) alwaysDetachable = false
[DEBUG]   (f) api = JPA
[DEBUG]   (f) classpathElements = [/home/me/workspace/myproject/target/classes, ...]
[DEBUG]   (f) detachListener = false
[DEBUG]   (f) fork = false
[DEBUG]   (f) generateConstructor = true
[DEBUG]   (f) generatePK = true
[DEBUG]   (f) log4jConfiguration = /home/me/workspace/myproject/target/classes/log4j.properties
[DEBUG]   (f) metadataDirectory = /home/me/workspace/myproject/target/classes
[DEBUG]   (f) metadataIncludes = com/mydomain/*.class
[DEBUG]   (f) pluginArtifacts = [org.datanucleus:datanucleus-maven-plugin:maven-plugin:4.0.0-release:, org.codehaus.plexus:plexus-utils:jar:3.0.8:compile, org.codehaus.plexus:plexus-component-annotations:jar:1.5.5:compile, org.sonatype.sisu:sisu-inject-bean:jar:2.3.0:compile, org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0:compile, org.sonatype.sisu:sisu-guava:jar:0.9.9:compile, org.apache.xbean:xbean-reflect:jar:3.4:compile, log4j:log4j:jar:1.2.12:compile, commons-logging:commons-logging-api:jar:1.1:compile, com.google.collections:google-collections:jar:1.0:compile, junit:junit:jar:3.8.2:compile]
[DEBUG]   (f) quiet = false
[DEBUG]   (f) useFileListFile = auto
[DEBUG]   (f) verbose = true
[DEBUG] -- end configuration --
[DEBUG] Metadata Directory is : /home/me/workspace/myproject/target/classes
[INFO]   CP: ...
[INFO]   CP: /home/me/workspace/myproject/target/classes
[INFO]   CP: ...
DataNucleus Enhancer (version 4.0.4) for API "JPA"
DataNucleus Enhancer : Classpath
>>  /usr/share/maven/boot/plexus-classworlds-2.x.jar
ERROR [main] DataNucleus.MetaData (Log4JLogger.java:115) - Class "com.mydomain.#UNKNOWN" has MetaData yet the class cant be found. Please check your CLASSPATH specifications.
Class "com.mydomain.MyClass" has MetaData yet the class cant be found. Please check your CLASSPATH specifications.
ERROR [main] DataNucleus.Enhancer (Log4JLogger.java:125) - DataNucleus Enhancer completed with an error. Please review the enhancer log (at DEBUG level) for full details. Some classes may have been enhanced but some caused errors
Class "com.mydomain.MyClass" has MetaData yet the class cant be found. Please check your CLASSPATH specifications.
org.datanucleus.metadata.InvalidClassMetaDataException: Class "com.mydomain.MyClass" has MetaData yet the class cant be found. Please check your CLASSPATH specifications.
    at org.datanucleus.metadata.ClassMetaData.populateMemberMetaData(ClassMetaData.java:468)
    at org.datanucleus.metadata.ClassMetaData.populate(ClassMetaData.java:219)
    at org.datanucleus.metadata.MetaDataManagerImpl$1.run(MetaDataManagerImpl.java:2822)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.datanucleus.metadata.MetaDataManagerImpl.populateAbstractClassMetaData(MetaDataManagerImpl.java:2816)
    at org.datanucleus.metadata.MetaDataManagerImpl.populateFileMetaData(MetaDataManagerImpl.java:2639)
    at org.datanucleus.metadata.MetaDataManagerImpl.initialiseFileMetaDataForUse(MetaDataManagerImpl.java:1324)
    at org.datanucleus.metadata.MetaDataManagerImpl.loadClasses(MetaDataManagerImpl.java:613)
    at org.datanucleus.enhancer.DataNucleusEnhancer.getFileMetadataForInput(DataNucleusEnhancer.java:711)
    at org.datanucleus.enhancer.DataNucleusEnhancer.enhance(DataNucleusEnhancer.java:488)
    at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1139)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.datanucleus.maven.AbstractDataNucleusMojo.executeInJvm(AbstractDataNucleusMojo.java:331)
    at org.datanucleus.maven.AbstractEnhancerMojo.enhance(AbstractEnhancerMojo.java:281)
    at org.datanucleus.maven.AbstractEnhancerMojo.executeDataNucleusTool(AbstractEnhancerMojo.java:81)
    at org.datanucleus.maven.AbstractDataNucleusMojo.execute(AbstractDataNucleusMojo.java:125)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

DataNucleus Enhancer已完成,但出现错误。请查看增强器日志(在DEBUG级别)以获取完整详细信息。某些类可能已得到增强,但有些类会导致错误

我检查了target/classes目录并且该类在那里。运行mvn compile会取得成功。

1 个答案:

答案 0 :(得分:0)

问题是@AssociationOverride注释名称错误@JoinColumn。我想错误信息应该更加清晰。