Reputation: 361
I'm adding some extra sources to my Maven project and until now all is working well. I just want to make the extra source selection a little more more generic, because today I have something like:
<source>client/plugins/plug1/classes</source>
<source>client/plugins/plug2/classes</source>
<source>client/plugins/plug3/classes</source>
<source>client/plugins/plug4/classes</source>
<source>client/plugins/plug5/classes</source>
...
And I want to do it in this way:
<source>client/plugins/**/classes</source>
That's because some developers do not have all the plugins under their working space, and I don't want to modify my pom.xml
in each dev environment.
Unfortunately that pattern doesn't work -at least in Eclipse- because the folders are not marked as source. I made a little research and I saw that Maven uses the Ant patterns but it is not working.
Could you please tell me if it is possible to use that convention in <sources>
definition?
Upvotes: 2
Views: 1414
Reputation: 137174
No, this is not possible.
The sources
attribute of the build-helper-maven-plugin:add-source
goal is a File
array, which means that every source must be a File
, hence you can't use an Ant path pattern. The plugin will literally add the file client/plugins/**/classes
as a source directory (and since it doesn't exist, nothing will happen). This is the logs that I had when I tested it:
[INFO] --- build-helper-maven-plugin:1.10:add-source (add-source) @ test ---
[INFO] Source directory: <omitted>\client\plugins\**\classes added.
But there's the matter of why you would want such a thing. It isn't clear from your question where are those "plugins" coming from but you shouldn't be in that situation. Each plugin should probably be a separate module of a multi-module Maven project. This way, each plugin will handle its build and you can add a dependency on those modules.
Upvotes: 2