Reputation: 11
My question is: I have java project and before compilation I need to replace some java files with custom files from external folder. I tried build-helper-maven-plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>custom_scr_directory</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
But is seems that it does not replace files, just add new source folder and that is why I have 'duplicate class' exception during compilation because files have the same names as in the main project.
Upvotes: 1
Views: 1236
Reputation: 841
A similar question is answered here (spoiler: antrun)
After all, build-helper:add-source would not do the trick, (it is intended to do what it does: add another source directory), you can safely drop it.
UPD: And yes, +1 to what khmarbaise said: you'll need profiles to make this goal conditional.
Upvotes: 1