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/
Related
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?
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
I have a JAVA EE Project, containing both EJB and WAR projects inside of it.
I want to be able to access WAR project class from the EJB project class.
I have access the other way ( I can access ejb class from war).
Is that possibble? How can this be done?
Thank's In Advance.
I assume that you have got an EAR with two modules inside, WAR and EJB JAR. As both modules are independent, they shouldn't depend on each other. What you want to do is possible via MANIFEST.MF Class-Path entry in module META-INF folder, but I strongly discourage you to do so.
You can re-factor you application to following structure:
EAR/
ejb-app.jar
war-app.jar
lib/
common-libraries.jar
Just putyour common libraries to separate JAR (regular java project), and add it to ejb-app and war-app classpath.
Alternatively you can implement EJB's in WAR project as they are supported in WAR since Java EE6.
I have a maven project which is packaged using the ejb-plugin. This is so because the project holds one interface which is annotated #Remote.The project does not hold the implementation.
Should I use the ejb-plugin here or is this a simple jar (used as a library)?
What makes a maven project an EJB-Module?
Use a simple jar packaging for module with interfaces.
In module with implementation use ejb packaging and define a simple jar dependency to module with interfaces. For modules with ejb packaging maven will run ejb:ejb mojo of maven-ejb-plugin - do configure it (e.g. set ejbVersion to 3.0). For ejb module Maven will produce a jar archive. What used to make ejb jar specific is ejb-jar.xml, but starting from EJB 3.0 that's optional, annotations are used for metadata. Valid deployable ejb jar is one that has at least one EJB bean (session, entity, or message-driven).
In third module with ear packaging you can configure maven-ear-plugin with a reference to ejb module; ear module will produce ear archive with ejb module included, and with all ejb module dependencies as well, including interfaces jar module.
I am writing an application that integrates Geoserver with a custom component, intended to be hosted on a single servlet engine. Both are Maven based projects, and I would like to stay in Maven land to package it all into a nice distributable. The general idea I have is to add another module to my application that packages the application itself, Geoserver and all dependencies into one nice archive.
I am aware of the maven-assembly-plugin and its capability of storing all dependencies in a target folder, but I am not sure what would be the best way to create a package that it easy to deploy. Googling for any examples has not been successful.
Extra bonus points if the module can be started via mvn jetty:run.
Have you considered packaging them into an EAR project. It will bundle a set of WARs (and jars), and allows you to specify or generate a deployment descriptor.