Maven eclipselink元模型不';清洁后产生的热量

Maven eclipselink元模型不';清洁后产生的热量,maven,jpa,eclipselink,Maven,Jpa,Eclipselink,我的项目配置为使用Eclipselink,构建工具是Maven。我需要在代码中使用JPA2元模型,因此我的pom.xml包含相关配置: <plugin> <groupId>org.bsc.maven</groupId> <artifactId>maven-processor-plugin</artifactId> <version>2.0

我的项目配置为使用Eclipselink,构建工具是Maven。我需要在代码中使用JPA2元模型,因此我的
pom.xml
包含相关配置:

        <plugin>
            <groupId>org.bsc.maven</groupId>
            <artifactId>maven-processor-plugin</artifactId>
            <version>2.0.4</version>
            <executions>
                <execution>
                    <id>process</id>
                    <goals>
                        <goal>process</goal>
                    </goals>
                    <phase>generate-sources</phase>
                    <configuration>
                        <outputDirectory>${project.build.directory}/generated-sources/metamodel</outputDirectory>
                        <compilerArguments>
                            -Aeclipselink.persistencexml=${project.basedir}/src/main/resources/META-INF/business/user/persistence.xml
                        </compilerArguments>
                        <processors>
                            <processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
                            </processor>
                        </processors>
                    </configuration>
                </execution>
            </executions>
        </plugin>
只有再次执行
mvn compile
后,我才成功编译

[INFO] --- maven-processor-plugin:2.0.4:process (process) @ fsdp-user-service-datalayer ---
[INFO] Source directory: <path>\UserService\DataLayer\target\generated-sources\metamodel added
[INFO] Adding compiler arg: -Aeclipselink.persistencexml=<path>\UserService\DataLayer/src/main/resources/META-INF/business/user/persistence.xml
[INFO] javac option: -cp
[INFO] javac option: <jars>
[INFO] javac option: -proc:only
[INFO] javac option: -Aeclipselink.persistencexml=<path>\UserService\DataLayer/src/main/resources/META-INF/business/user/persistence.xml
[INFO] javac option: -processor
[INFO] javac option: org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
[INFO] javac option: -d
[INFO] javac option: <path>\UserService\DataLayer\target\classes
[INFO] javac option: -s
[INFO] javac option: <path>\UserService\DataLayer\target\generated-sources\metamodel
[INFO] diagnostic <path>\UserService\DataLayer\src\main\java\user\dao\impl\UserDAOImpl.java:11: cannot find symbol
symbol  : class UserEntity_
location: package user.entity
[INFO] diagnostic Note: Creating static metadata factory ...
[INFO] diagnostic Note: Found Option : eclipselink.persistencexml, with value: <path>\UserService\DataLayer/src/main/resources/META-INF/business/user/persistence.xml
[INFO] diagnostic Note: Optional file was not found: META-INF/orm.xml continuing with generation.
[INFO] diagnostic Note: Optional file was not found: META-INF/eclipselink-orm.xml continuing with generation.
[INFO] diagnostic Note: File loaded : META-INF/business/user/orm.xml, is eclipselink-orm file: false
[INFO] diagnostic Note: Found Option : eclipselink.persistencexml, with value: <path>\UserService\DataLayer/src/main/resources/META-INF/business/user/persistence.xml
[INFO] diagnostic Note: Optional file was not found: META-INF/orm.xml continuing with generation.
[INFO] diagnostic Note: Optional file was not found: META-INF/eclipselink-orm.xml continuing with generation.
[INFO] diagnostic Note: File loaded : META-INF/business/user/orm.xml, is eclipselink-orm file: false
[INFO] diagnostic warning: The following options were not recognized by any processor: '[eclipselink.persistencexml]'
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ fsdp-user-service-datalayer ---
[debug] execute contextualize
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ fsdp-user-service-datalayer ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 12 source files to <path>\UserService\DataLayer\target\classes
[INFO] 
[INFO] --- aspectj-maven-plugin:1.4:compile (compile) @ fsdp-user-service-datalayer ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.720s
[INFO] Finished at: Thu Aug 02 17:45:18 MSK 2012
[INFO] Final Memory: 26M/62M
[INFO] ------------------------------------------------------------------------
[INFO]——maven处理器插件:2.0.4:process(process)@fsdp用户服务数据层---
[INFO]源目录:\UserService\DataLayer\target\generated sources\metamodel已添加
[INFO]添加编译器参数:-Aeclipselink.persistencexml=\UserService\DataLayer/src/main/resources/META-INF/business/user/persistence.xml
[INFO]javac选项:-cp
[INFO]javac选项:
[INFO]javac选项:-proc:仅限
[INFO]javac选项:-Aeclipselink.persistencexml=\UserService\DataLayer/src/main/resources/META-INF/business/user/persistence.xml
[INFO]javac选项:-处理器
[INFO]javac选项:org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
[INFO]javac选项:-d
[INFO]javac选项:\UserService\DataLayer\target\classes
[INFO]javac选项:-s
[INFO]javac选项:\UserService\DataLayer\target\generated sources\metamodel
[INFO]diagnostic\UserService\DataLayer\src\main\java\user\dao\impl\UserDAOImpl.java:11:找不到符号
符号:类用户实体_
位置:包user.entity
[信息]诊断说明:正在创建静态元数据工厂。。。
[信息]诊断说明:找到选项:eclipselink.persistencexml,值为:\UserService\DataLayer/src/main/resources/META-INF/business/user/persistence.xml
[信息]诊断说明:未找到可选文件:META-INF/orm.xml正在继续生成。
[信息]诊断说明:未找到可选文件:META-INF/eclipselink-orm.xml继续生成。
[信息]诊断说明:加载的文件:META-INF/business/user/orm.xml,是eclipselink orm文件:false
[信息]诊断说明:找到选项:eclipselink.persistencexml,值为:\UserService\DataLayer/src/main/resources/META-INF/business/user/persistence.xml
[信息]诊断说明:未找到可选文件:META-INF/orm.xml正在继续生成。
[信息]诊断说明:未找到可选文件:META-INF/eclipselink-orm.xml继续生成。
[信息]诊断说明:加载的文件:META-INF/business/user/orm.xml,是eclipselink orm文件:false
[信息]诊断警告:任何处理器都无法识别以下选项:“[eclipselink.persistencexml]”
[信息]
[信息]---maven资源插件:2.5:资源(默认资源)@fsdp用户服务数据层---
[调试]执行上下文化
[警告]使用平台编码(实际上是UTF-8)复制过滤后的资源,即构建依赖于平台!
[信息]正在复制3个资源
[信息]
[信息]---maven编译器插件:2.3.2:compile(默认编译)@fsdp用户服务数据层---
[警告]未使用平台编码UTF-8设置文件编码,即生成依赖于平台!
[INFO]正在将12个源文件编译为\UserService\DataLayer\target\classes
[信息]
[INFO]——aspectj maven插件:1.4:compile(compile)@fsdp用户服务数据层---
[信息]------------------------------------------------------------------------
[信息]建立成功
[信息]------------------------------------------------------------------------
[信息]总时间:4.720s
[信息]完成时间:2012年8月2日星期四17:45:18
[信息]最终内存:26M/62M
[信息]------------------------------------------------------------------------
两个日志之间的主要区别在于“Unsuccess clean compile”日志的以下几行内容:

[INFO] diagnostic Note: File loaded : META-INF/business/user/orm.xml, is eclipselink-orm file: false
[INFO] diagnostic Note: Found Option : eclipselink.persistencexml, with value: <path>\UserService\DataLayer/src/main/resources/META-INF/business/user/persistence.xml
[INFO] diagnostic Note: Optional file was not found: META-INF/orm.xml continuing with generation.
[INFO] diagnostic Note: Optional file was not found: META-INF/eclipselink-orm.xml continuing with generation.
[INFO] diagnostic Note: File loaded : META-INF/business/user/orm.xml, is eclipselink-orm file: false
[INFO]诊断说明:加载的文件:META-INF/business/user/orm.xml,是eclipselink orm文件:false
[信息]诊断说明:找到选项:eclipselink.persistencexml,值为:\UserService\DataLayer/src/main/resources/META-INF/business/user/persistence.xml
[信息]诊断说明:未找到可选文件:META-INF/orm.xml正在继续生成。
[信息]诊断说明:未找到可选文件:META-INF/eclipselink-orm.xml继续生成。
[信息]诊断说明:加载的文件:META-INF/business/user/orm.xml,是eclipselink orm文件:false
但是“成功编译”日志没有


所以问题是:为什么我会有如此奇怪的行为?

您能在不成功的运行之前找到user/orm.xml文件,然后在运行之后查找它吗?这个过程需要它来构建元模型,我猜只有在元模型创建过程之后,才会将它复制到需要它的地方。这可能就是为什么您会收到“未找到文件”消息,从而阻止创建UserEntity。第二步可以找到路径上的文件,从而创建编译UserDAOImpl类所需的UserEntity<应该在persistence.xml路径中使用code>{basedir}而不是
{project.basedir}
在运行失败之前找到user/orm.xml文件,然后在运行之后查找它吗?这个过程需要它来构建元模型,我猜只有在元模型创建过程之后,才会将它复制到需要它的地方。这可能就是为什么您会收到“未找到文件”消息,从而阻止创建UserEntity。第二步可以找到路径上的文件,从而创建编译UserDAOImpl类所需的UserEntity<应该在persistence.xml路径中使用code>{basedir}而不是
{project.basedir}
[INFO] diagnostic Note: File loaded : META-INF/business/user/orm.xml, is eclipselink-orm file: false
[INFO] diagnostic Note: Found Option : eclipselink.persistencexml, with value: <path>\UserService\DataLayer/src/main/resources/META-INF/business/user/persistence.xml
[INFO] diagnostic Note: Optional file was not found: META-INF/orm.xml continuing with generation.
[INFO] diagnostic Note: Optional file was not found: META-INF/eclipselink-orm.xml continuing with generation.
[INFO] diagnostic Note: File loaded : META-INF/business/user/orm.xml, is eclipselink-orm file: false