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

  • SEARCH
  • Home
  • 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 8398395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:02:45+00:00 2026-06-09T21:02:45+00:00

I have authored a mojo that generates code and sticks it under {root}/target/generated-sources/foo .

  • 0

I have authored a mojo that generates code and sticks it under {root}/target/generated-sources/foo. When I execute:

mvn clean install

I get errors indicating that the generated sources are not being included in the build path (the generated files are there, but not being picked up in the compile phase). I understand from this answer that I need to dynamically add {root}/target/generated-sources/foo as a source directory for the POM. Problem is, I haven’t been able to track down any information on how to do this.

As a backup plan, I intend to use the Build Helper Maven Plugin, but I was hoping to do this automatically in my mojo if possible.

  • 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-09T21:02:46+00:00Added an answer on June 9, 2026 at 9:02 pm

    I prefer to add this to my Mojo:

    /**
      * The current project representation.
      * @parameter expression="${project}"
      * @required
      * @readonly
      */
     private MavenProject project;
    
    /**
     * Directory wherein generated source will be put; main, test, site, ... will be added implictly.
     * @parameter expression="${outputDir}" default-value="${project.build.directory}/src-generated"
     * @required
     */
    private File outputDir;
    

    Obviously you can change the default-value to match your own pattern.

    And then in the execute() method:

    if (!settings.isInteractiveMode()) {
        LOG.info("Adding " + outputDir.getAbsolutePath() + " to compile source root");
    }
    project.addCompileSourceRoot(outputDir.getAbsolutePath());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have authored some custom classes that I would like to create using XAML:
I have an msi (authored with WIX) that has a check box bound to
Using Apache Felix, I have an OSGi component I've authored that wraps some middleware
Due to a number of reasons I have ended up with some code that
have written this little class, which generates a UUID every time an object of
I have a website authored in PHP where any time a user receives an
Does PHP have a function that returns a file extension given a content type?
I have this code NSDictionary *tempDict = [NSDictionary dictionaryWithObjects: [NSArray arrayWithObjects:@authorId,authorName,authorDescription,@image,nil] forKeys: [NSArray arrayWithObjects:@id,@name,@desc,@image,nil]];
I have the following code snippet: var matchingAuthors = from authors in DB.AuthorTable where
I have been trying to create a page using views that will list down

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.