On Feb 15, 2005, at 9:08 AM, James Adams wrote:

Tim thanks for your message.  You have brought up a
very good point, in that the WAR and EJB pieces of my
application do essentially go together, so there's no
real need to build a WAR and EJB JAR to include in an
EAR when I can just create the EAR instead.  If this
is the case then I need to figure out the correct
layout for my development directories which Maven will
expect to find when I run maven ear.

An ear file is not a mishmash of random classes and files, it has other modules inside. Your only choice with an ear that is intended to have a web app component and an ejb component is to include a war and ejb jar in your ear

1. Where do the JSP pages & image directories go ? Do these go in src/webapp, or is this only relevant for maven war ? What about the WEB-INF with the web.xml etc. ?

in the embedded war file

2. Where do I put the ejb-jar.xml and jboss.xml ? Should I perhaps keep all of the JBoss related config files such as jboss.xml and jboss-web.xml someplace else and separate from the base application, in order to make the code more generic ? How would one go about isolating just the JBoss elements into their own areas, but then including these when building an EAR ?

The j2ee stuff pretty much has to go in the embedded ejb jar file, although there are some tricks you can play with alternate dd's with the application.xml. Since you are building the whole thing yourself it is apt to be more convenient to include the actual dds in the modules.


What you do with the app server specific plans depends partly on which j2ee level your app server supports. For a j2ee 1.4 app server I find that external plans are pretty convenient.

3. I have some JMX MBean classes that need to be deployed in a separate SAR file (in order to be run as JBoss services), but which the classes of my application access indirectly. Is there a special directory layout for these classes and their associated META-INF/jboss-service.xml ? Also these MBean classes use a few classes found in the core of the application (some custom Exception and JavaBean classes) - how is this handled ? Should this be a separate project from the main application ?

You should be able to get the sar on the classpath of the other modules by using the manifest classpath of the modules. How you encourage jboss to deploy the sar is another question.

4. Do I need to create an application.xml for the EAR
?  how to begin ?  It seems that since I have no web
or ejb modules then I don't need to specify anything
in the application.xml.

you need application.xml in your ear to indicate which modules should actually be deployed. As noted above, you need at least a web and ejb module in your ear.

david jencks


Thanks in advance for any help.


--James



--- Tim Stephenson <[EMAIL PROTECTED]> wrote:

James,

Are the three directory structures you describe
different projects
(each with own project.xml) or do they overlap? If
they overlap this
is the first thing to change. I can't find the
reference on the FAQ or
elsewhere in the web site, but I am pretty sure
maven strongly advises
against creating several artifacts (jar, war etc.)
from a single
project, which I think makes perfect sense but it
can be a hurdle to
understanding maven for some people I have had
conversations with.

Assuming that they are different projects, you
should be able to build
the EJB and the WAR files already? In the respective
project dir you
should run 'ejb:install' and 'war:install'. This
will build the EJB
and WAR files and place them into your local
repository. For more
help, check the EJB and WAR plugin reference pages
at:

  http://maven.apache.org/reference/plugins/ejb/ and

  http://maven.apache.org/reference/plugins/war/

Then in the EAR project's project.xml you need to
specify these
dependencies for the EJB and WAR projects with some
special properties
to say they should be bundled in the EAR file. It
will look something
like this:

                <dependency>
                        <groupId>MyProj</groupId>
                        <artifactId>MyProj-ejb</artifactId>
                        <version>1.0</version>
                        <type>ejb</type>
                        <properties>
                                <ear.bundle>true</ear.bundle>
                        </properties>
                </dependency>
                <dependency>
                        <groupId>MyProj</groupId>
                        <artifactId>MyProj-web</artifactId>
                        <version>1.0</version>
                        <type>war</type>
                        <properties>
                        

<ear.appxml.war.context-root>/MyWeb</ear.appxml.war.context-root>

<ear.bundle>true</ear.bundle> </properties> </dependency>

Finally run the goal 'ear' (or 'ear:install') to
create the EAR file.
More help on the EAR plugin is available at:

    http://maven.apache.org/reference/plugins/ear/

Hope this helps,
Tim

On Mon, 14 Feb 2005 15:49:35 -0800 (PST), James
Adams
<[EMAIL PROTECTED]> wrote:
I want to build an EAR file which contains a WAR
and
EJB JAR. Currently I am able to have all of my
class
files put into a single JAR, whether I do "maven
ejb"
or "maven war", but really what I want is a goal
which
will

1. Create the WAR with all JSPs and Servlet
classes.

My project's directory layout as far as web
components
goes looks like this:

myproject
 +-- src
       +-- java
             +-- all needed packages including
servlets
       +-- webapp
             +-- WEB-INF
                   +-- web.xml
                   +-- jboss-web.xml
             +-- all JSP and HTML files, img
directories, etc.

2.  Create the EJB JAR with all EJB and dependency
classes

My project's directory layout as far as EJB
components
goes looks like this:

myproject
 +-- src
       +-- java
             +-- all needed packages including
ejbs
       +-- ejb
             +-- META-INF
                   +-- jboss.xml
                   +-- ejb-jar.xml

3. Create an EAR file which includes both the WAR
and
EJB JAR created above

My project's directory layout as far as EAR
components
goes looks like this:

myproject
 +-- src
       +-- application
             +-- META-INF
                   +-- application.xml

In the end I want the EAR to contain the EJB JAR
and
WAR files, with an application.xml specifying the
modules.  Is this possible ?  Are the directory
layouts above what I need for this sort of Maven
goal
? Since the Servlet and EJB classes are both
under
the src/java directories how will I tell Maven
which
classes need to go in the WAR file and which ones
go
in the EJB JAR ?

Any suggestions greatly appreciated !

--James

__________________________________
Do you Yahoo!?
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com



---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]



__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to