本文介绍了如何在Maven中启用Ebean Enhancement?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用 ORM图层虽然,但我不明白如何启用。

I've been using Avaje.org ebean ORM layer for a while, but I don't understand how to enable the byte-code enhancement functionality described in the "Ebean v2.6.0 User Guide" with Maven.

我找到了,但它不起作用。 GitHub上的也没有。

I found a configuration example on the Avaje.org homepage, but it doesn't work. Neither does the demo Maven boilerplate on GitHub.

帮助!

推荐答案

EBeans现在有自己的Maven插件,但我找不到任何在线文档,以下是如何使用它的示例:

EBeans now has its own Maven Plugin, but I can't find any documentation online, so here is an example of how to use it:

<plugin>
    <groupId>org.avaje.ebeanorm</groupId>
    <artifactId>avaje-ebeanorm-mavenenhancer</artifactId>
    <version>${ebean.version}</version>
    <executions>
        <execution>
            <id>main</id>
            <phase>process-classes</phase>
            <goals>
                <goal>enhance</goal>
            </goals>
            <configuration>
                <packages>com.package1.**,com.package2.**</packages>
                <transformArgs>debug=1</transformArgs>
                <classSource>${project.build.outputDirectory}</classSource>
                <classDestination>${project.build.outputDirectory}</classDestination>
            </configuration>
        </execution>
    </executions>
</plugin>

使用Eclipse

如果您使用Eclipse,则需要确保它在需要时运行插件,如下所示:

If you use Eclipse, you will want to make sure it runs the plugin when needed, like this:

<build>
    <plugins>
        <!-- plugins here -->
    </plugins>
    <pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. -->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.avaje.ebeanorm</groupId>
                                    <artifactId>avaje-ebeanorm-mavenenhancer</artifactId>
                                    <versionRange>[3.3.2,)</versionRange>
                                    <goals>
                                        <goal>enhance</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute>
                                        <runOnConfiguration>true</runOnConfiguration>
                                        <runOnIncremental>true</runOnIncremental>
                                    </execute>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

这篇关于如何在Maven中启用Ebean Enhancement?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 14:07