Creating EAR file using Maven - java

I am facing an issue while creating EAR file using Maven of a Dynamic Web Project.
I have successfully created WAR file using POM.xml , but can anybody tell me how to write EAR script in POM.xml ?
Thanks in advance

It easy.
You need:
Root project, parent pom that have 2 modules - war and ear.
Move your war to war module
create ear module (add war as dependency)
You can use archetype:generate to create example of ear. For example archetype with id: 612.
612: remote -> org.jboss.spec.archetypes:jboss-javaee6-ear-webapp (An
archetype that generates a starter Java EE 6 webapp project for JBoss
AS 7. The project is an EAR, with an EJB-JAR and WAR)
If you don't need ejb - just delete it. In generated example ejb is optional.

Check my archetype for maven, this is for Java EE 6
https://github.com/sjpuas/jee6-archetype

Related

How to remove jar files from war file when deploying a java web application with jboss

I built my netbeans project and it created a .war file including all the .jar libraries. I need to remove my all libraries from .war file. I tried to untick them from library folder but then the project does not deployed. How can I remove my libraries from the .war file and if I remove them where should I put them correctly. In jboss also there is a folder called lib in standalone folder.Should I put them there? If so how to do it. I am not using maven.
If you are using Maven set the dependency scope to the libraries you would like omitted to have scope provided. You can add the dependencies of your WAR to the MANIFEST.MF file or the jboss-deployment-structure.xml file using Maven. If the lirbaries are not JBoss modules by default, eg Orcale JDBC driver, then you will need to create these modules yourself. See the JBoss AS 7 documentation on how to do this.
You can try following approach. I haven't worked on Jboss so don't have detail idea about it.
Deploy each logical library (like "OpenJPA" or "Log4J") as a module, including its api and impl jars and any dependency JARs that aren't already provided by other AS7 modules. If there's already a module add a dependency on it rather than adding a JAR to your module. If several different libraries share some common dependencies, split them out into modules and add them as module dependencies in module.xml.
Use jboss-deployment-structure.xml to have your deployment .war / .ear / whatever declare a dependency on the module if it isn't autodetected and autoloaded.
Courtesy #Craig Ringer.
For complete thread go here

appropriate maven project structure for MDB and EAR

I have a headless (ie no war component) business object that I wish to install on my app server as an EAR. I understand to do this I would need to create a maven project to generate this Message Driven Bean's jar as normal, but then for the ear I'd need a separate maven project to generate the ear. Would this be a parent project or what is the correct abstraction?
Typcally you will have this Kind of Project structure:
parent (packaging pom)
-- ear (packaging ear)
-- ejb-jar (packaging ejb)
Have a look at this article. It's Java EE 5 but explains the structure very well
http://www.developerscrappad.com/1177/java/java-ee/maven/building-and-deploying-java-ee-ear-with-maven-to-java-ee-application-server-part-1-project-directory-structure-amp-module-generation-through-archetype-generate/

Copy dependency to war before packaging

I'm packaging an ear file with maven for an IBM Content Navigator plugin project. This product requires to have an ear, which includes a war, and that war should include the plugin as jar in the root of the war. So not in the WEB-INF/lib. The ear and the war are just empty containers.
So I've created 3 projects, an ear, a web project, and a simple java project. All of these projects have a pom.
How can I create a war which includes the simple java project (jar) in the root of the war? It is not just a dependency as it must not end up in the WEB-INF/lib.
Thanks in advance,
Roeland Bestman
You need to use the maven-dependency-plugin's copy goal and place the jar in a directory under the target directory. Then you'll need to include it from there into your war using the maven-assembly-plugin.

how to make multi module Ear project in eclipse and maven

i am new to Ear kind project i can make a war project now i want to add my all war project in a Ear project by using maven but not able to get success my pom.xml file of Ear project gives me the error
and i am not able to get that, if any one has the solution please help.
thanks in adv.

How Can I have single project in Maven including EAR , WAR and EJB?

I am building this application for a client where one project folder with one pom file should consists all the EAR, WAR and EJB.
I found each of its own way in creating the project structure like http://www.jboss.org/jdf/quickstarts/jboss-as-quickstart/guide/Archetype/
How to create my own maven structure for this or are there any available archtype I can use?

Categories

Resources