Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

491
Views
querydsl generate Q classes in src/main/java

I am using querydsl in my spring project and want to generate Q classes at src/main/java/xxx/xxx/model/here . When I write except for src/main/java at my pom.xml, it will work. But, When I write src/main/java, it will not work.(doesn't generate q classes.) Do you know why? In src/main/java, there are another classes I wrote. Is it impossible to generate Q classes at existing place?

Here is my pom.xml

<plugin>
    <groupId>com.mysema.maven</groupId>
    <artifactId>apt-maven-plugin</artifactId>
    <version>1.1.3</version>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <goals>
                <goal>process</goal>
            </goals>
            <configuration>
                <outputDirectory>src/main/java</outputDirectory>
                <processor>
                    com.querydsl.apt.jpa.JPAAnnotationProcessor
                </processor>
            </configuration>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-apt</artifactId>
            <version>${querydsl.version}</version>
        </dependency>
    </dependencies>
</plugin>
about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You should add the directory path in target like this:

target/generated-sources/java

about 4 years ago · Santiago Trujillo Report

0

First of all why do you think of generating them in source folder. That way you are complicating your actual codebase. They are auto generated files. They are supposed to be as given below

<configuration>
    <outputDirectory>target/generated-sources/querydsl</outputDirectory>
    <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>

But if you still need them in src folder , follow steps below.

  1. Disable Project › Build Automatically…
  2. Run Maven goal 'generate-sources', which runs apt-maven-plugin
  3. Refresh the project in Eclipse, the generated source files are present as expected
  4. Project › Build Project

The folder with generated sources is created.

You may look at the class path setting for the project. Now you can use all Q classes wherever you need.

project build path

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!