...
In order to configure GEP to publish Maven dependencies as shared library, you will need to install Maven Integration for Eclipse. To install m2eclipse plugin, follow the instructions at given
Setup:
Sun Java v1.5.0_11 + Apache Geronimo v2.0.2
Eclipse 3.3.1 + WTP2.0.1 + Geronimo Eclipse Plugin v2.0
Maven Integration for Eclipse (m2eclipse v0.0.12)
Maven Integration for Eclipse:
...
at http://m2eclipse.codehaus.org/
...
Step-1:
Follow the instructions at <link to be added here> to add Geronimo 2.0 server runtime into WTP, and to create & deploy an "HelloWorld" Dynamic Web project.
...
. The configuration steps are illustrated using a web application and adding a dependency on commons-dbcp library.
- Create a HelloWorld Dynamic Web project as given in Developing a Hello World Web application.
- Enable Maven 2 support for the web-app project
...
- as given below:
- In Project Explorer view, right click on
...
- HelloWorld, select
...
- Maven -> Enable Dependency Management
...
- .
- Leave default options as-is and click
...
- Finish
...
- .
- To add a dependency on commons-dbcp library:
- In Project Explorer view, right click on HelloWorld, select
- Maven -> Add Dependency
...
- .
- Enter
...
- commons-dbcp
...
- as query,
...
- in
...
- Search Results
...
- select
...
- 1.3-SNAPSHOT-commons-dbcp-1.3-..
...
- and click
...
- OK
...
- .
...
- To use a class from commons-dbcp library inside the web application's
index.jsp
:- Double click on
...
- HelloWorld -> WebContent -> index.jsp
...
- to open it in JSP editor.
- Add
...
- the following code before the </body> tag.
<br><%= org.apache.commons.dbcp.DriverConnectionFactory.class.getName() %>
- the following code before the </body> tag.
...
- Press
- Ctrl + S
...
- to save the changes.
Make sure
- to save the changes.
...
org.apache.commons.dbcp.DriverConnectionFactory
...
class is resolved with no
...
type not resolved
...
errors.
...
- Enable in-place shared library support in Server editor as given below:
- In
...
- Servers
...
- view, double click on
...
- Apache Geronimo v2.
...
- 1 Server at localhost to open the server editor.
- In the server editor, under
...
- Test Environment
...
- , select
...
- Enable in-place shared library support.
...
- Press Ctrl + S to save the changes.
- To add a dependency on org.apache.geronimo.configs/sharedlib//car in
geronimo-web.xml
...
- :
- Double click on
...
- HelloWorld -> Web Content -> WEB-INF -> geronimo-web.xml
...
- to open it in Geronimo Deployment Plan Editor.
- In
...
- General
...
- tab, select
...
- Add a run time dependency to Geronimo's shared library
...
- .
- Press
- .
...
- Ctrl+S
...
- to save the file.
In
- to save the file.
...
Source
...
tab,
...
a dependency on geronimo/sharedlib//car
...
would be added as below:
...
<sys:
...
dependency>
...
<sys:groupId>geronimo</sys:groupId>
...
<sys:artifactId>sharedlib</sys:artifactId>
...
<sys:type>car</sys:type>
...
</sys:dependency>
...
This is due to a current bug in Geronimo Deployment Plan Editors. Change <sys:groupId> from geronimo to org.apache.geronimo.configs and press Ctrl + S to save the changes.
- To run the HelloWorld application:
- Right click on HelloWorld, click Run As -> Run on Server.
- Select Apache Geronimo v2.1 Server at localhost and click Finish. This will run the application and the welcome page will open in a browser inside eclipse.
Use the steps below to verify that maven dependency is indeed added as a shared library:
- Verify that a file
HelloWorld.eclipse.jar
is created under<geronimo_home>/var/shared/lib
. - Verify that the
Manifest.mf
file in HelloWorld.eclipse.jar contains the following:Manifest-Version: 1.0 Class-Path: file:/E:/m2repo/commons-pool/commons-pool/1.3/commons-pool -1.3.jar file:/E:/m2repo/commons-dbcp/commons-dbcp/1.3-SNAPSHOT/commo ns-dbcp-1.3-SNAPSHOT.jar The file path used in the manifest Class-Path may differ based on the location of your maven2 repository.
...