清理后不会生成Maven eclipselink元模型

时间:2012-08-02 13:52:31

标签: maven jpa eclipselink

我的项目配置为使用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 clean 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 list>
[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: Optional file was not found: META-INF/business/user/orm.xml continuing with generation.
[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 11 source files to <path>\UserService\DataLayer\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] <path>\UserService\DataLayer\src\main\java\user\dao\impl\UserDAOImpl.java:[11,57] cannot find symbol
symbol  : class UserEntity_
location: package user.entity
[ERROR] <path>\UserService\DataLayer\src\main\java\user\dao\impl\UserDAOImpl.java:[99,22] cannot find symbol
symbol  : variable UserEntity_
location: class user.dao.impl.UserDAOImpl
[INFO] 2 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.112s

只有在再次执行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] ------------------------------------------------------------------------

两个日志之间的主要区别是“unscess 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

但“成功编译”日志没有。

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

0 个答案:

没有答案