Intellij doesn't build my maven projects using configured plugins

Hi,

I have a multi-module maven project. One of the modules defines my OpenJPA model classes and the maven build has the openjpa-maven-plugin configured like so:


        <plugins>
            <plugin>
                <groupId>org.apache.openjpa</groupId>
                <artifactId>openjpa-maven-plugin</artifactId>
                <version>2.2.0</version>
                <configuration>
                    <includes>**/*.class</includes>
                    <!--<excludes>**/model/XML*.class</excludes>-->
                    <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>${openjpa.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>

This works from the command line and my tests pass OK. However when I run from Intellij after making any edits to my classes (causing IDEA to recompile them), the tests fail because the classes have not been enhanced at build time.
If I then compile at the command line and run the tests again from IDEA, they pass OK.

How can I get IDEA to run the maven builds as they are run from the command line? I thought this was the whole idea behind maven integration!?

Thanks,

Alex

1 comment
Comment actions Permalink

Default JUnit test run configuration does only "Make" which only compiles the classes. If you need to run extra processing (like enhancing classes in your case) you need to alter your JUnit test run configuration and add extra step ("Run Maven Goal") in "Before lauch" section.

0

Please sign in to leave a comment.