Find Oracle JDBC driver in Maven repository

前端 未结 22 1424
你的背包
你的背包 2020-11-22 09:28

I want to add the oracle jdbc driver to my project as dependency (runtime scope) - ojdbc14. In MVNrepository site the dependency to put in the POM is:



        
22条回答
  •  遇见更好的自我
    2020-11-22 10:19

    For whatever reason, I could not get any of the above solutions to work. (Still can't.)

    What I did instead was to include the jar in my project (blech) and then create a "system" dependency for it that indicates the path to the jar. It's probably not the RIGHT way to do it, but it does work. And it eliminates the need for the other developers on the team (or the guy setting up the build server) to put the jar in their local repositories.

    UPDATE: This solution works for me when I run Hibernate Tools. It does NOT appear to work for building the WAR file, however. It doesn't include the ojdbc6.jar file in the target WAR file.

    1) Create a directory called "lib" in the root of your project.

    2) Copy the ojdbc6.jar file there (whatever the jar is called.)

    3) Create a dependency that looks something like this:

    
        com.oracle
        ojdbc
        14
        system
        ${basedir}/lib/ojdbc6.jar 
    
    

    Ugly, but works for me.

    To include the files in the war file add the following to your pom

    
        MyAppName
        
            
                org.apache.maven.plugins
                maven-war-plugin
                
                    
                        
                            ${basedir}/src/main/java
                            WEB-INF/classes
                            
                                **/*.properties
                                **/*.xml
                                **/*.css
                                **/*.html
                            
                        
                        
                            ${basedir}/lib
                            WEB-INF/lib
                            
                                **/*.jar
                            
                        
                    
                
            
    
            
                maven-compiler-plugin
                
                    1.6
                    1.6
                
            
        
    
    

提交回复
热议问题