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 8663387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:58:31+00:00 2026-06-12T16:58:31+00:00

I understand how Maven works with .java files in src/java/main. But may it be

  • 0

I understand how Maven works with .java files in src/java/main. But may it be used for a more general case? Let us put it more abstract: Suppose I already have some a.exe that reads some (not necessarily only .java) sources from directories A1, A2, A3 and puts some files (maybe some are generated .java) to directories B1, B2. I also have some b.exe that currently reads files from B1, B2, B3 and generates something else. Some more similar steps. (A real life problem stands behind).

I would like to write a POM.xml file so that maven will do this work. Is that possible? I assume that a.exe and b.exe should be warped as maven plugings.
Next, in Maven docs I see :

<build>
    <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
    <scriptSourceDirectory>${basedir}/src/main/scripts</scriptSourceDirectory>
    <testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>
    <outputDirectory>${basedir}/target/classes</outputDirectory>
    <testOutputDirectory>${basedir}/target/test-classes</testOutputDirectory>
    ...
</build>

What bothers me is that “sourceDirectory” looks by itself as a hard coded name. Will Maven accept A1 and A2 tags instead?

  • 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-12T16:58:32+00:00Added an answer on June 12, 2026 at 4:58 pm

    (Will you consider accepting some of your previous questions, so that other people will be more willing to answer you?)

    Maven stress for Convention over Configuration. You can treat sourceDirectory as one of the conventions, which we have predefined some elements to use with the (Java) compiler plugin.

    What you want to do can be achieved. You can write a plugin/MOJO yourself, which read from whatever directory you want and invoke whatever external exe you want. By having reasonable default values in your MOJO, you can have your project POM look something like

    <project>
      :
      :
      <build>
        <plugins>
          <plugin>
            <groupId>yourPluginGroup</group>
            <artifactId>generate-A-data</artifactId>
            <!-- if you want extra configuration, you can have <configuration> elements -->
          </plugin>
    
          <plugin>
            <groupId>yourPluginGroup</group>
            <artifactId>generate-B-data</artifactId>
          </plugin>
        </plugins>
      </build>
    <project>
    

    Not that bad huh?

    However, it is quite questionable to say whether Maven is “flexible”. I believe flexibility is never the aim of Maven. Maven is specialized for building, it defines different skeletons for you to follow (e.g. build phases, dependency scopes), you can never make Maven as “flexible” as other script-based tools like Ant.

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

Sidebar

Related Questions

I'm trying to understand the maven-release-plugin (version 2.0, CVS). The release-prepare works well. But
I found that Maven implies specific directory layout. But I don't understand from here:
I'm trying to use JSFUnit framework, but can't understand how to allocate projects/files. How
I've used a Maven archetype ( webapp-javaee6 ) to create a new Java EE
I understand that part of the appeal of setting up a Maven mirror, such
I understand that this can be done at release using the maven-gpg-plugin. However, I
I understand this is an easy question but for some reason this just isn't
I understand what weak tables are. But I'd like to know where weak tables
After installing maven ( mvn -v works fine), I tried to do mvn install
I understand that Maven has a number of phases that run in the order

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.