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?
(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
sourceDirectoryas 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
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.