Question

Hibernate's new dirty check policy was introduced in HHH-8354. I'm interested in using that improvement in my project using the (also new) maven compile time enhancement, but there is no documentation or explanations regarding these new features.

As far as I understand, the pom needs to look like this:

<plugins>  
    ....
    <plugin>
        <groupId>org.hibernate.orm.tooling</groupId>
        <artifactId>hibernate-enhance-maven-plugin</artifactId>
        <version>4.3.5.Final</version>
        <executions>
            <execution>
                <phase>compile</phase>
                <goals>
                    <goal>enhance</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
</plugins>

But for some reason enhance goal is not recognized by Eclipse. In addition I would like to further configure it in order to exclude folders and files (other configuration voodoo help would be appreciated too)

Was it helpful?

Solution

I used this as an answer. The comments also helps with related issues and explanations

OTHER TIPS

If Eclipse does not know how to handle this plugin, first thing to do is to set preferences so it will ignore it. But in our case there will be missing source files, that were supposed to be generated by the faulty plugin. Here is how to fix that:

Run mvn package -DskipTests from the command line. It should compile without errors (or else you have to fix them first and then bother with Eclipse again). Then go back to Eclipse, select your project files and refresh (F5).

You should find out a folder named like generated_sources in the target folder (there may be a subfolder, eg target/generated_sources/annotations). Right click and add it to build Path.

enter image description here

Depending on your maven configuration (for example in case of a multi-module project), you may have to further configure build pathes in order to include the project with the generated source files in the build path of project who reference these sources

NB: Remember that it is a bad practice to add anything in your pom to fix such problems, since it will impact everybody else on your team, who don't necessarily use Eclipse for their IDE. But if you have no other way, you should consider creating a maven profile for your IDE specifics.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top