I want to show README.md
file like help page in my web application. In order not to create duplicate, I need to copy by mvn
from project path into resources.
How can I do so?
Any idea?
I have tried:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.3</version>
<configuration>
<!-- this is important -->
<overwrite>true</overwrite>
<!-- target -->
<outputDirectory>${basedir}/target/classes</outputDirectory>
<resources>
<resource>
<!-- source -->
<directory>/</directory>
<include>
<filter>**/README.md</filter>
</include>
</resource>
</resources>
</configuration>
</plugin>
This works for me in one of my projects:
I see that i have the phase and the goal extra from your version. I also used variables for the output location.
I would recommend you to be more equal to this example: http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html With "more equal" I mean like using
<executions>
tag.You can of course leave out things like
<id>
andfiltering
.The following worked fine for me:
The simplest solution would be to move the appropriate file(s) to
src/main/resources
folder whereas the second solution could be like this:No need for maven-resources-plugin to be configured this can be handled by the usual life cylcle and resource handling. The only thing you might need to adapt is the folder where the
README.md
is located. If you like having filtering you need to add the<filtering>true</filtering>
part as well.Copying something via Maven during the build into
src/**
is in general a bad idea, cause those folders are controled by version control systems which will result in uncommitted changes which you don't like to have.Note: It would be wise to check for up-to-date versions of plugins (cause 2.3 is of 2008!). The list of the current plugin versions can be found here: http://maven.apache.org/plugins/