tags:

views:

128

answers:

1

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:

  1. This is a standard j2ee ear file, with 1 WAR in it.
  2. 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

  1. 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.
  2. 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)
+3  A: 

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).

Pascal Thivent
Well, I was kind of looking for something just like what you mentioned, the Maven AntRun plugin. I need to be able to take a file from a given location, and place it the EAR somewhere. That is exactly what I need.
Zombies
@Zombies Hint: you'll have to execute the Ant `<copy>` task from the Maven Antrun plugin before the `package` phase, maybe during `pre-package`.
Pascal Thivent
%s/pre-package/prepare-package/g
Pascal Thivent