How to enable Ebean Enhancement in Maven?

I used the Avaje.org ebean ORM layer for a while, but I don’t understand how to enable the byte code extension functionality described in the “Ebean v2.6.0 User Guide” with Maven.

I found an example configuration on the Avaje.org homepage, but it does not work. In addition, there is no Maven demo template on GitHub .

Help!

+5
source share
3 answers

EBeans now has its own Maven plugin, but I cannot find the documentation on the Internet, 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>

With eclipse

Eclipse, , , :

<build>
    <plugins>
        <!-- plugins here -->
    </plugins>
    <pluginManagement>
        <plugins>
            <!--This plugin 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>
+7

EBeans, , .

Avaje .

  • : "process-ebean-enhancement" Maven, . - " ".
  • "classSource" . , ebean @Entity , . - ${project.build.outputDirectory}.
  • . "com.mycompany. **" .

:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
                <execution>
                    <id>process-ebean-enhancement</id>
                    <phase>process-classes</phase>
                    <configuration>
                        <tasks>
                            <property name="compile_classpath" refid="maven.compile.classpath" />
                            <echo
                                message="Ebean enhancing test classes debug level -----------------------------------" />
                            <echo message="Classpath: ${compile_classpath}" />
                            <taskdef name="ebeanEnhance" classname="com.avaje.ebean.enhance.ant.AntEnhanceTask"
                                classpath="${compile_classpath}" />
                            <ebeanEnhance classSource="${project.build.outputDirectory}"
                                packages="com.mycompany.**" transformArgs="debug=1" />
                        </tasks>
                        <encoding>UTF-8</encoding>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>  

@Entity "src/main/java/com/mycompany" .

, .

, , . "proces-test-classes" .

+2

JBCP ebean (org.avaje.ebeanorm). (io.ebean) ebean-maven-plugin.

<plugin>
    <groupId>io.ebean</groupId>
    <artifactId>ebean-maven-plugin</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>

. ebean plugin , ebean.

: Maven Repo, Github

+1

All Articles