Search code examples
eclipsevaadinivyivyde

Ivy resolves Oracle JDBC dependency but doesn't deploy jar with other dependencies


hoping someone can shed some light on a problem I've been working on. I'm in the process over changing a small project over to Vaadin from GWT, I have all my libraries working except for the Oracle JDBC driver (ojdbc6.jar). After reading around I discovered this library isn't available through public Maven repo's so I started working on adding it to Ivy from my local filesystem.

Here's the problem. I have been able to get Ivy to resolve the dependency and add it to the ivy cache however it will only add it to my lib/jars folder and not into the WAR\WEB-INF\lib folder. All my other dependencies seem to be working as expected and are deployed to the WEB-INF\lib folder, C3P0 gets as far as starting up a db pool but fails when trying to load the JDBC driver.

My filesystem setup is the first resolver listed in the ivy-settings.xml - hope someone can help!

PROJECT SETUP

  • Vaadin 7.1.11
  • Eclipse Juno
  • IvyDE 2.2.0final

FILE STRUCTURE​

*C:\dev-vaadin\ivy.repo*

  • ivy6.xml
  • ojdbc6.jar

.ivy2\cache\com.oracle\ojdbc

  • jars\
  • ivy-6.xml
  • ivy-6.xml.original
  • ivydata-6.properties

.ivy2\cache\com.oracle\ojdbc\jars

  • ojdbc-6.jar

CODE

ivy.xml

 1<?xml version="1.0"?>
 2<!DOCTYPE ivy-module [
 3    <!ENTITY vaadin.version "7.1.11">
 4]>
 5<ivy-module version="2.0"
 6    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 7    xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
 8    <info organisation="com.example" module="v7proj" />
 9    <configurations>
10        <!-- The default configuration, which should be deployed to the server -->
11        <conf name="default" />
12        <!-- A configuration only needed when compiling the widget set. Should 
13            not be deployed to the server -->
14        <conf name="widgetset-compile" />
15        <!-- A configuration used in compilation of server side classes only.
16            Should be deployed to the server -->
17        <conf name="nodeploy" />
18    </configurations>
19    <dependencies defaultconf="default" defaultconfmapping="default->default">
20        <!-- The core server part of Vaadin -->
21        <dependency org="com.vaadin" name="vaadin-server" rev="&vaadin.version;" />
22
23        <!-- Vaadin themes -->
24        <dependency org="com.vaadin" name="vaadin-themes" rev="&vaadin.version;" />
25
26        <!-- Push support -->
27        <dependency org="com.vaadin" name="vaadin-push" rev="&vaadin.version;" />
28        
29        <!-- log4j -->
30        <dependency org="log4j" name="log4j" rev="1.2.17" conf="default" />
31        
32        <!-- c3p0 -->
33        <dependency org="com.mchange" name="c3p0" rev="0.9.2.1" conf="default" />
34        
35        <!-- Oracle JDBC -->
36        <dependency org="com.oracle" name="ojdbc" rev="6" conf="default" />
37        
38        <!-- simple-java-mail -->
39        <dependency org="org.codemonkey.simplejavamail" name="simple-java-mail" rev="2.1" conf="default" />
40        
41        <!-- GWT -->
42        <dependency org="com.google.gwt" name="gwt-servlet" rev="2.5.1" conf="default" />
43
44        <!-- Apache Commons -->
45        <dependency org="org.apache.commons" name="commons-lang3" rev="3.2.1" conf="default" />
46
47        <!-- Servlet 3.0 API -->
48        <dependency org="javax.servlet" name="javax.servlet-api" rev="3.0.1" conf="default" />
49
50        <!-- Precompiled DefaultWidgetSet -->
51        <dependency org="com.vaadin" name="vaadin-client-compiled"
52            rev="&vaadin.version;" />
53
54        <!-- Vaadin client side, needed for widget set compilation -->
55        <dependency org="com.vaadin" name="vaadin-client" rev="&vaadin.version;"
56             conf="widgetset-compile->default" />
57
58        <!-- Compiler for custom widget sets. Should not be deployed -->
59        <dependency org="com.vaadin" name="vaadin-client-compiler"
60            rev="&vaadin.version;" conf="widgetset-compile->default" />
61    </dependencies>
62 </ivy-module>

ivy-settings.xml

 1<?xml version="1.0" encoding="UTF-8"?>
 2<ivysettings>
 3    <property name="repo.dir" value="C:/dev-vaadin/ivy.repo" />
 4    <settings defaultResolver="default" />
 5    <resolvers>
 6        <chain name="default">
 7            <!-- Localhost filesystem repository -->
 8            <filesystem name="internal">
 9                <ivy pattern="${repo.dir}/ivy[revision].xml" />
10                <artifact pattern="${repo.dir}/[artifact][revision].[ext]" />
11            </filesystem>
12        
13            <!-- Public Maven repository -->
14            <ibiblio name="public" m2compatible="true" />7
15
16            <!-- Vaadin Add-on repository -->
17            <ibiblio name="vaadin-addons" usepoms="true" m2compatible="true"
18                root="http://maven.vaadin.com/vaadin-addons" />
19
20            <!-- Vaadin snapshots repository -->
21            <ibiblio name="vaadin-snapshots" usepoms="true" m2compatible="true"
22                root="https://oss.sonatype.org/content/repositories/vaadin-snapshots" />
23            <!-- Repository used for Vaadin modified smartsprites library -->
24            <dual name="custom-smartsprites">
25                <filesystem name="smartsprites-ivy">
26                    <ivy pattern="${basedir}/ivymodule/[module]-ivy-[revision].xml" />
27                </filesystem>
28                <url name="smartsprites-artifact">
29                    <artifact
30                        pattern="http://dev.vaadin.com/svn/versions/6.8/build/smartsprites/lib/[artifact](-[revision]).[ext]" />
31                </url>
32            </dual>
33        </chain>
34    </resolvers>
35    <modules>
36        <!-- Vaadin patched SmartSprites -->
37        <module organisation="com.carrotsearch" name="smartsprites"
38            revision="0.2.3-itmill" resolver="custom-smartsprites" />
39    </modules>
40
41
42</ivysettings>

Solution

  • In eclipse have a look at your project properties. There is a point called "Deployment Assembly" which should contain at least these two entries:

    /src          -> WEB-INF/classes
    /WebContent   -> /
    

    Then you can add

    /Ivy   -> WEB-INF/lib
    

    Make sure that all your needed libraries are included in the Deployment Assembly.