Maven: How to add files to the root inside an EAR with maven-ear-plugin

maven-2maven-ear-plugin

I need to add 2 XML files inside an EAR generated with maven-ear-plugin.

Unfortunately, I haven't seen a way to add an arbitrary file to an EAR; the documentation of the plugin which reads "The EAR plugin supports the following artifacts: ejb, war, jar, ejb-client, rar, ejb3, par, sar, wsr and har". There's nothing for adding a regular file.

org.apache.maven.plugins
maven-ear-plugin
2.3.1

foo
foo
1.4
lib

${parent.groupId}
foo-web
/foo

org.richfaces.framework
richfaces-api

commons-lang
commons-lang

Many thanks in advance.

Best Answer

In maven-ear-plugin 2.4.2 you can use config elements earSourceDirectory, earSourceExcludes and earSourceIncludes to declare extra files to include in the EAR.

By default you simply place those files to ${basedir}/src/main/application folder.