How to create an EAR file for an existing Maven Project

I have developed a web application that up till now I was testing locally using Tomcat as the server.

I now wish to move to Oracle WebLogic Server 11gR1 (10.3.5) for further use. I looked up and found out that there are .ear files such as .war file that are supported. Since I am using Eclipse, I have downloaded and installed the Weblogic Plugin in it and successfully added the server too.

However, if I wish to deploy a .ear file on WebLogic what are the steps that I need to follow? Is there a specific file structure that my existing Maven Project needs to have?

I am not successfully able to export the .ear file from eclipse. I understand that once the .ear file is ready, I can move the same to my WebLogic C:\*BaseDirectry*\*BaseName*\applications folders and run it from there.

But how do I successfully create a .ear file of my existing maven project?


The structure I would suggest in these cases is to have a maven multimodule project providing your application module (jar packaging), a war module (war packaging) and an ear module (ear packaging) in order to have a clear separation of concerns and have maven build a single artifact per module.

If your project is currently a classic maven project, you can create an aggregator module project (pom packaging) as following:

    <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">



This means the aggregator project will point to maven modules existing in subfolders, and The application module is a simple Maven project providing your application logic and building a jar file out of it. It is not mandatory, but it can also point as a parent to the aggregator project (aggregation and inheritance are two different things in Maven, which can be mixed together or used differently). You can declare the parent project in modules as following:


In the application module, you don't need to specify packaging, since by default it will jar, while in the ear and war module, packaging will be respectively ear and war.

The war module will need to have the application module as its dependency. The WAR module is also a good location to place integration tests. You could also configure here a jetty maven plugin start/stop as part of pre/post-integration-test phase. The war module will also provide the required src\main\webapp\WEB-INF structure

The ear module will need to have the war module as its dependency and it is important to specify its type, war, as following:


Note the war. The ear module will also provide the required src\main\application\META-INF structure. The ear module can configure the maven-ear-plugin simply as following:


its application.xml file (under src\main\application\META-INF) can simply look like below:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "">

It might look over-complicated as a structure, but it gives you control over modules and artefacts, meets maven best practices and improves your focus (i.e. application code only on the application module, integration tests only on the war module).

Need Your Help

How to make dojo datagrid to have editable row data, sortable and pagination

php mysql json dojo dojox.grid

I have a dojo datagrid with datastore of json type. I have already accomplished to display data fetched from mysql database. What I would like to do is to allow pagination, make row data editable and