我的Maven项目已经增长,所以我决定尝试制作一个Maven多模块项目。
我认为它似乎工作得很好,除了Eclipselink元模型类生成。
这是运行mvn clean generate-sources
的输出,这是不期望的:
[INFO] javac option: -proc:only
[INFO] javac option: -Aeclipselink.persistencexml=/home/glassfish/git/vehiclecms/vehiclecms-parent/vehiclecms-backend/src/main/resources/META-INF/persistence.xml
-Aeclipselink.persistenceunits=carcmsPU
-Aeclipselink.canonicalmodel.subpackage=metamodel
[INFO] javac option: -processor
[INFO] javac option: org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
[INFO] javac option: -d
[INFO] javac option: /home/glassfish/git/vehiclecms/vehiclecms-parent/vehiclecms-backend/target/classes
[INFO] javac option: -s
[INFO] javac option: /home/glassfish/git/vehiclecms/vehiclecms-parent/vehiclecms-backend/target/generated-sources
[INFO] diagnostic warning: Supported source version 'RELEASE_6' from annotation processor 'org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor' less than -source '1.7'
[INFO] diagnostic Note: Creating static metadata factory ...
[INFO] diagnostic Note: Found Option : eclipselink.persistencexml, with value: /home/glassfish/git/vehiclecms/vehiclecms-parent/vehiclecms-backend/src/main/resources/META-INF/persistence.xml
-Aeclipselink.persistenceunits=carcmsPU
-Aeclipselink.canonicalmodel.subpackage=metamodel
[INFO] diagnostic Note: The persistence xml file [/home/glassfish/git/vehiclecms/vehiclecms-parent/vehiclecms-backend/src/main/resources/META-INF/persistence.xml
-Aeclipselink.persistenceunits=carcmsPU
-Aeclipselink.canonicalmodel.subpackage=metamodel] was not found. NO GENERATION will occur!! Please ensure a persistence xml file is available either from the CLASS_OUTPUT directory [META-INF/persistence.xml] or using the eclipselink.persistencexml property to specify its location.
这部分的pom.xml是:
<!-- Generate JPA Criteria Meta Model classes -->
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.0.6</version>
<executions>
<execution>
<id>process</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<outputDirectory>${basedir}/target/generated-sources</outputDirectory>
<compilerArguments>-Aeclipselink.persistencexml=${basedir}/src/main/resources/META-INF/persistence.xml
-Aeclipselink.persistenceunits=carcmsPU
-Aeclipselink.canonicalmodel.subpackage=metamodel</compilerArguments>
<processors>
<processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor</processor>
</processors>
</configuration>
</execution>
</executions>
</plugin>
我无法理解为什么这不起作用,它与我单模块项目中的相同。 Maven或Eclipselink似乎在多模块项目中不起作用,或者我在这里错过了什么?
答案 0 :(得分:0)