Maven apt-get-plugin for mysema

17,004

Solution 1

Another possible solution, if you only need to generate Q classes from JPA entity classes, is to use the classifier for querydsl-apt like:

<dependency>
    <groupId>com.querydsl</groupId>
    <artifactId>querydsl-apt</artifactId>
    <version>${querydsl.version}</version>
    <classifier>jpa</classifier>
</dependency>

In that case you don't need manual apt-maven-plugin build configuration at all.

Solution 2

This is an error that you will see very often in eclipse. Basically, Eclipse tries to match a plugin to an m2e connector. If it fails to do so, because you have not installed a suitable connector, you get this error.

Resolving it is quite straitforward: Hover your mouse over the error. You are presented with 3 possible quick fixes, like this: Insert your plugin name

They have the following effects:

  • Discover new m2e connectors: probably the most sensible one: Look for a m2e connector and install it. This solves the problem for your eclipse installation (for this specific plugin)
  • Mark goal FOOBAR as ignored in [...] Eclipse preferences: This sets a preference within your local Eclipse installation to ignore that Eclipse didn't find a m2e connector for this specific plugin
  • Permanently mark goal [...] in pom.xml [...]: This will introduce a configuration snippet in the pom.xml of the project to ignore that eclipse doesn't find a m2e connector.

If there isn't an m2e connctor for the plugin you're using, you will want to ignore this problem, as it is very Eclipse specific. Your maven build will run nevertheless (e.g. via command line), and when you configure Eclipse to ignore the plugin, the Eclipse maven plugin will build your project fine as well. If you want to share the configuration with your team, or have different eclipse installations, add the configuration to your pom. If you prefer not to have the pom polluted by IDE specific settings (like I do), rather use the eclipse preference.

Here is some more detail about this issue: https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html

Solution 3

This is a quite old version of the plugin and probably that's the reason why it's not covered. Please update to the configuration displayed here https://github.com/mysema/apt-maven-plugin

Share:
17,004
Arry
Author by

Arry

An eternal student of Computer Science. Senior Data Engineer @ Intuit

Updated on June 04, 2022

Comments

  • Arry
    Arry almost 2 years

    I have added following snippet in my pom.xml, but in eclipse the execution part is error saying:

    Plugin execution not covered by lifecycle configuration: com.mysema.maven:maven-apt-plugin:1.0.3:process (execution: default, phase: generate-sources)
    

    Though when I am running mvn clean install from command line it is working properly then.

    <build>
            <plugins>
                <plugin>
                    <groupId>com.mysema.maven</groupId>
                    <artifactId>maven-apt-plugin</artifactId>
                    <version>1.0.3</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>process</goal>
                            </goals>
                            <phase>generate-sources</phase>
                            <configuration>
                                <outputDirectory>${project.basedir}/target/generated-sources/java</outputDirectory>
                                <processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
                                <processors>
                                    <processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
                            </processors>
                            <showWarnings>true</showWarnings>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
    

    After running from command line, its generating query dsl classes (QClasses), but from eclipse its not generating them.

    Also, when I am running my application from eclipse, it gives following error:

    Caused by: java.lang.ClassNotFoundException: xxx.QClass
    

    Is there some problem with eclipse maven plugin? How can I resolve this?