1

Hibernate3 Maven Plugin を使用してリバース エンジニアリングを行っています。これは pom.xml の一部です。

<plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>hibernate3-maven-plugin</artifactId>
            <version>2.2</version>
            <executions>
                <execution>
                    <id>hbm2java</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>hbm2java</goal>
                    </goals>
                    <configuration>
                        <components>
                            <component>
                                <name>hbm2java</name>
                                <implementation>jdbcconfiguration</implementation>
                                <outputDirectory>target/generatedClasses</outputDirectory>
                            </component>

                        </components>
                        <componentProperties>
                            <jdk5>true</jdk5>
                            <ejb3>false</ejb3>
                            <revengfile>/src/main/resources/reverse/engineering/hibernate.reveng.xml</revengfile>
                            <reversestrategy>/src/main/resources/reverse/engineering/MyReverseEngineeringStrategy.java</reversestrategy>
                            <propertyfile>src/main/resources/hibernate.properties</propertyfile>
                            <configurationFile>target/generatedClasses/hibernate.cfg.xml</configurationFile>
                        </componentProperties>
                    </configuration>
                </execution>

データベースへの接続は問題ないようですが、「MyReverseEngineeringStrategy.java」と宣言したクラスではなく、デフォルトの reverseStrategy に従ってクラスが作成されます。そして、スタックトレースでこのエラーが発生します。

[ERROR] Could not create or find /src/main/resources/reverse/engineering/MyReverseEngineeringStrategy.java with one argu
ment delegate constructor
java.lang.ClassNotFoundException: /src/main/resources/reverse/engineering/MyReverseEngineeringStrategy.java
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:171)
        at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:123)
        at org.codehaus.mojo.hibernate3.configuration.JDBCComponentConfiguration.loadReverseStrategy(JDBCComponentConfig
uration.java:100)
        at org.codehaus.mojo.hibernate3.configuration.JDBCComponentConfiguration.doConfiguration(JDBCComponentConfigurat
ion.java:42)
        at org.codehaus.mojo.hibernate3.configuration.AbstractComponentConfiguration.getConfiguration(AbstractComponentC
onfiguration.java:56)
        at org.codehaus.mojo.hibernate3.HibernateExporterMojo.configureExporter(HibernateExporterMojo.java:200)
        at org.codehaus.mojo.hibernate3.HibernateExporterMojo.doExecute(HibernateExporterMojo.java:273)
        at org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:152)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:365)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:199)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

Eclipse で休止状態ツール プラグインを使用すると、逆の戦略でクラスを生成できましたが、プロジェクトを Eclipse から独立させたいと考えています。助言がありますか!

4

1 に答える 1