我是否应该在openjpa maven插件中添加openjpa依赖项,如果它已经存在于依赖项中?

时间:2015-01-23 14:37:22

标签: maven dependencies openjpa

我使用OpenJPA作为JPA提供程序。

我将此依赖项放在 pom.xml

<dependency>
        <groupId>org.apache.openjpa</groupId>
        <artifactId>openjpa-all</artifactId>
        <version>2.3.0</version>
</dependency>    

和openjpa-maven-plugin

<plugin>
            <groupId>org.apache.openjpa</groupId>
            <artifactId>openjpa-maven-plugin</artifactId>
            <version>2.3.0</version>
            <configuration>
                <includes>**/entities/*.class</includes>
                <addDefaultConstructor>true</addDefaultConstructor>
                <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
            </configuration>
            <executions>
                <execution>
                    <id>enhancer</id>
                    <phase>process-classes</phase>
                    <goals>
                        <goal>enhance</goal>
                    </goals>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>org.apache.openjpa</groupId>
                    <artifactId>openjpa</artifactId>
                    <version>2.3.0</version>
                </dependency>
            </dependencies>
</plugin>    

如果它已经在pom.xml中,我是否应该再次在插件中添加openJPA依赖?它的目的是什么?

谢谢。

1 个答案:

答案 0 :(得分:0)

如果您需要不在项目依赖项中的特定依赖项,则必须在插件配置中放置依赖项。

我不知道openjpa的用法,但在你的例子中,pom中的依赖关系与插件配置中的依赖关系并不完全相同。因此,如果插件类需要在openjpa-all工件中不是同一个类,则需要保持插件依赖性。

相关问题