【发布时间】:2012-05-10 05:59:25
【问题描述】:
我遵循 JPA modelgen guide 并且能够生成我需要的规范元模型。有了这个 pom 设置:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-proc:none</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.0.6-redhat</version>
<executions>
<execution>
<id>process</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<outputDirectory>target/metamodel</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/metamodel</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
生成的源在指定目录中正确创建,我必须手动将其指定为 eclipse 项目类路径中的源才能使用它。当我触发 Maven 时,日志显示 cannot find symbol 或 duplicate class 并且我仍然可以成功构建。所以我的问题是,这是创建元模型的预期/正确行为吗?还是我错过了 cofig 中的某些内容?谢谢
【问题讨论】:
-
FIY,看看jpa-metamodel-with-maven