簡體   English   中英

hibernate3-maven-plugin與hibernate4不兼容

[英]hibernate3-maven-plugin not compatible with hibernate4

hibernate3-maven-plugin與hibernate4不兼容,嘗試在該插件中運行任何目標時出現以下錯誤。 我該如何規避這個問題?

[ERROR] Failed to execute goal org.codehaus.mojo:hibernate3-maven-plugin:2.2:hbm2
ddl (create sql schema) on project framework: Execution create sql schema of goal
org.codehaus.mojo:hibernate3-maven-plugin:2.2:hbm2ddl failed: An API incompatibi
lity was encountered while executing org.codehaus.mojo:hibernate3-maven-plugin:2.
2:hbm2ddl: java.lang.IllegalAccessError: tried to access method org.hibernate.cfg
.Configuration.<init>(Lorg/hibernate/cfg/SettingsFactory;)V from class org.hibern
ate.ejb.Ejb3Configuration

使用此配置

<plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>hibernate3-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <components>
                        <component>
                            <name>hbm2ddl</name>
                            <implementation>jpaconfiguration</implementation>
                        </component>
                    </components>
                    <componentProperties>
                        <outputfilename>schema.ddl</outputfilename>
                        <create>true</create>
                        <export>false</export>
                        <format>true</format>
                        <drop>true</drop>
                        <jdk5>true</jdk5>
                        <propertyfile>target/test-classes/jdbc.properties</propertyfile>
                        <skip>${skipTests}</skip>
                    </componentProperties>
                </configuration>
                <!--<executions>-->
                <!--<execution>-->
                <!--<phase>process-test-resources</phase>-->
                <!--<goals>-->
                <!--<goal>hbm2ddl</goal>-->
                <!--</goals>-->
                <!--</execution>-->
                <!--</executions>-->
                <dependencies>
                    <dependency>
                        <groupId>org.hibernate</groupId>
                        <artifactId>hibernate-entitymanager</artifactId>
                        <version>${hibernate.maven.plugin.version}</version>
                        <exclusions>
                            <exclusion>
                                <groupId>cglib</groupId>
                                <artifactId>cglib</artifactId>
                            </exclusion>
                            <exclusion>
                                <groupId>commons-logging</groupId>
                                <artifactId>commons-logging</artifactId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                    <dependency>
                        <groupId>org.hibernate</groupId>
                        <artifactId>hibernate-core</artifactId>
                        <version>${hibernate.maven.plugin.version}</version>
                        <exclusions>
                            <exclusion>
                                <groupId>cglib</groupId>
                                <artifactId>cglib</artifactId>
                            </exclusion>
                            <exclusion>
                                <groupId>commons-logging</groupId>
                                <artifactId>commons-logging</artifactId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                    <dependency>
                        <groupId>org.hibernate</groupId>
                        <artifactId>hibernate-validator</artifactId>
                        <version>4.2.0.Final</version>
                    </dependency>
                    <dependency>
                        <groupId>${jdbc.groupId}</groupId>
                        <artifactId>${jdbc.artifactId}</artifactId>
                        <version>${jdbc.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

並將<hibernate.maven.plugin.version>3.6.10.Final</hibernate.maven.plugin.version>到pom屬性中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM