How to make a custom ear file in maven
Here is my challenge, I need to make an ear file for a specific container. To be more specific on how this ear will be created:
- This is a standard j2ee ear file, with 1 WAR in it.
- The container it is deployed to will expect certain xml files (which 开发者_运维知识库can easily be found (somewhere) inside the source project).
Here are my obstacles
- The source folder contains various container specific xml files. But, these files do not map directly to where the container expects them inside the EAR file. For example, there will be a file that this container expects to be in 'EARFILE.ear/config/connections.xml'. But this file is located (in the source) at /some/obscure/unrelated/directory. This is the case for about 5-7 files.
- I cannot change the original source project layout at all.
So, how can I create the compliant EAR file that I need. There is NO plugin at this time for the container that I am using, I have certainly looked.
Update:
The original layout is for JDeveloper:
.adf
/META-INF/
(some xml files to map to various locations in the EAR)
Model
ViewController
public_html
src/
META-INF/
(some xml files to map to various locations in the EAR)
This is a standard j2ee ear file, with 1 WAR in it. The container it is deployed to will expect certain xml files (which can easily be found (somewhere) inside the source project).
As I told you in this previous answer, the typical layout for a maven project with a war and an ear module would look like this:
. |-- ear | |-- src | | `-- main | | `-- application | | |-- META-INF | | | `-- application.xml | | `-- config | | `-- connections.xml | `-- pom.xml |-- web | +-- src | `-- pom.xml `-- pom.xml
Where the files under the ${basedir}/src/main/application
directory will be included in the EAR (this is the default value of the earSourceDirectory
parameter).
The source folder contains various container specific xml files. But, these files do not map directly to where the container expects them inside the EAR file. (...)
I'm sorry but... what source folder? It would be maybe possible to use the Maven AntRun plugin to copy some files to the ear project from another location but 1. that would be very messy and 2. without more details, it is impossible to provide more guidance.
I cannot change the original source project layout at all.
Which looks like? You really need to give more details (and if you can't change anything, mavenizing this project may not be easy at all, especially if you're new to maven).
精彩评论