Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9155761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:39:10+00:00 2026-06-17T12:39:10+00:00

I have my maven file defined as follows to generate source code from apache

  • 0

I have my maven file defined as follows to generate source code from apache torque.

 <build>
<plugins>
  <plugin>
    <groupId>org.apache.torque</groupId>
    <artifactId>torque-maven-plugin</artifactId>
    <version>4.0-beta1</version>
    <executions>
      <execution>
        <id>generate-sources</id>
        <phase>generate-sources</phase>
        <goals>
          <goal>generate</goal>
        </goals>
        <configuration>
          <packaging>classpath</packaging>
          <configPackage>org.apache.torque.templates.om</configPackage>
          <sourceDir>src/main/schema</sourceDir>
          <defaultOutputDir>src/main/java/generated-java</defaultOutputDir>
          <options>
            <torque.om.package>com.project.om</torque.om.package>
            <torque.database>mysql</torque.database>
          </options>
        </configuration>
      </execution>
      <execution>
        <id>generate-sql</id>
        <phase>generate-sources</phase>
        <goals>
          <goal>generate</goal>
        </goals>
        <configuration>
          <packaging>classpath</packaging>
          <configPackage>org.apache.torque.templates.sql</configPackage>
          <sourceDir>src/main/schema</sourceDir>
          <defaultOutputDir>src/main/resources/generated-sql</defaultOutputDir>
          <defaultOutputDirUsage>none</defaultOutputDirUsage>
          <options>
            <torque.database>mysql</torque.database>
          </options>
        </configuration>
      </execution>
    </executions>
    <dependencies>
      <dependency>
        <groupId>org.apache.torque</groupId>
        <artifactId>torque-templates</artifactId>
        <version>4.0-beta1</version>
      </dependency>
    </dependencies>
  </plugin>

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>sql-maven-plugin</artifactId>
    <version>1.4</version>
    <configuration>
      <driver>org.gjt.mm.mysql.Driver</driver>
      <url>jdbc:mysql://localhost:3306/daydiary</url>
      <username>root</username>
      <password>mysql</password>
      <onError>continue</onError>
      <autocommit>true</autocommit>
      <fileset>
        <basedir>${basedir}/target/generated-sql</basedir>
        <includes>
          <include>*.sql</include>
        </includes>
      </fileset>
    </configuration>
    <dependencies>
      <dependency>
        <artifactId>mysql-connector-java</artifactId>
        <groupId>mysql</groupId>
        <version>5.0.4</version>
      </dependency>
    </dependencies>
  </plugin>

  <plugin>
    <!-- setting java version to 1.5 --> 
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
      <source>1.5</source>
      <target>1.5</target>
    </configuration>
  </plugin>

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
      <execution>
        <id>copy-dependencies</id>
        <phase>package</phase>
        <goals>
          <goal>copy-dependencies</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
</plugins>

For this maven creates the following folder structure as shown in the picture
I need every code generated under src/main/java folder.How can i achieve that.?

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:39:11+00:00Added an answer on June 17, 2026 at 12:39 pm

    Your generated classes are going to <defaultOutputDir>src/main/java/generated-java</defaultOutputDir> but all folders under src/main/java in maven are treated as package names. So It thinks that generated-java is a package name, but In classes the package name is specified as com.project.om and thats why it shows as an error in you IDE.

    I’m not sure how this plugin works but you could try changing the output directory to ‘src/main/java’ It might not work because plugin might be cleaning this dir before generating src files and you don’t want your files to be deleted.

    Other option would be generate those files outside the src/main/java folder (in default location for example) and then:
    copy-override those files to the src/main/java directory for example with maven-antrun-plugin
    add the location of those generated files as a source directory with build-helper-maven-plugin.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this Maven task to generate Java classes from an XSD file using
I use maven-jaxb2-plugin to generate jaxb annotated classes from xsd. I have many xsd
I have a maven pom.xml file with multiple instances of a same goal defined
For example, let's say I have a Maven build file that has dependencies located
I am using maven to build applications. I have deployed a WAR file containing
I have a POM defined in the Ant file, the build works correctly, pulling
I have a Maven POM file with a plugin that runs on the test
Currently I have a simple maven project that is building a jar file and
I recently changed my password and have to change my maven settings.xml file to
I have maven-plagin and need to run goal, that should automatically run before plugin.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.