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:
- To see what the Maven Integration for Eclipse can do, please view the Flash demo at http://m2eclipse.codehaus.org/Maven_2.0_Plugin_for_Eclipse.html
- To install m2eclipse plug-in, please follow the instructions 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.
Step-2:
Enable Maven 2 support for the web-app project and add a dependency:
- In Project Explorer view, right click on "Hello World" web-app project, select "Maven -> Enable Dependency Management". Leave default options as-is and click "Finish".
- Right click again on "Hello World" web-app project and select "Maven -> Add Dependency". Enter "commons-dbcp" as query, and in "Search Results" select say "1.3-SNAPSHOT-commons-dbcp-1.3-.." and click "OK".
Step-3:
- Double click on "HelloWorld -> WebContent -> index.jsp" to open it in JSP editor.
- Add "<br><%= org.apache.commons.dbcp.DriverConnectionFactory.class.getName() %>" before the "</body>" tag.
- Click "Ctrl + S" to save changes.
- Make sure "org.apache.commons.dbcp.DriverConnectionFactory" class is resolved with no "type not resolved" errors.
Step-4:
- In "Servers" view, double click on the server instance (like "Apache Geronimo v2.0 Server ..") to open the server editor.
- In server editor, under "Test Environment", select "Enable in-place shared library support." as shown below:
- Save and close the server editor.
Step-5:
- Double click on "Hello World -> 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" as below:
- Press "Ctrl+S" to save the file.
- In "Source" tab, a dependency on geronimo/sharedlib//car would be added as below:
<sys:dependencies>
<sys:dependency>
<sys:groupId>geronimo</sys:groupId>
<sys:artifactId>sharedlib</sys:artifactId>
<sys:type>car</sys:type>
</sys:dependency>
</sys:dependencies> - For Geronimo v2.0 & above, change <sys:groupId> to "org.apache.geronimo.configs" as below: (this is due to a current bug in Geronimo Deployment Plan Editors)
<sys:groupId>org.apache.geronimo.configs</sys:groupId>
- Press "Ctrl + S" again to save the changes.
Step-6:
- Redeploy & run the web-app by right-clicking on "Hello World -> Web Content -> index.jsp" and selecting "Run As -> Run on Server -> Finish".
- Make sure you get an output as below:
- In Windows explorer, go to <GERONIMO_HOME>\var\shared\lib and observe that a "HelloWorld.eclipse.jar" is created and this jar contains a Manifest.mf file with contents as below:
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