This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Oracle Drivers using Maven Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Oracle Drivers using Maven" Watch "Oracle Drivers using Maven" New topic
Author

Oracle Drivers using Maven

Anirudh Vyas
Ranch Hand

Joined: Oct 23, 2006
Posts: 93
Hi,

I need oracle drivers for a maven project that i am working on. My question is how to install the drivers on the maven repository (local).
I am looking for complete command line thing for maven.I know that it goes something like:

mvn install:install-file -Dfile={Should i put complete path here?} -DgroupId=org.jdbc.OracleDriver <-- is this right?

I dont know what should come in artifact and version. Can someone give me the whole command line thing?

Any help would be appreciable.

Regards
Vyas, Anirudh


Vyas, Anirudh
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Actually, because you are placing the jar into your local repository, you can use any name and version you like. Personally, I would use a group id of "com.oracle.jdbc" and an artifact id of the actual jar file name without any version number or the jar suffix (I'd be more specific, but I don't use Oracle).

What I usually do is update my pom.xml file to include a dependency on JAR. Then I know how I want to reference the JAR. When I run mvn, it gives me the full command line for installing the jar.

And yes, you should provide the full path for the file property.


JBoss In Action
Anirudh Vyas
Ranch Hand

Joined: Oct 23, 2006
Posts: 93
Thanks for the reply!

I actually posted this question a while back on maven mailing list (but in my utter stupidity while i was cleaning my stored / archived mails) i deleted the command / chain which helped me solve the problem earlier.

Here's the actual command that would work for reference (It should presumably help others as well, i am going to post this on my site's maven basics section ) :

mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14
-Dversion=10.0.2.0.0 -Dpackaging=jar -Dfile=path/to/file


After that you can run mvn clean install and it works! Oh and you have to manually copy jars to m2 repository folder m2/com/oracle/ <<YOUR VERSION>>/ <<JARS GO HERE>>

Regards
Vyas, Anirudh
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Why do you have to manually copy the JAR files? The mvn install command should be doing that for you.
Anirudh Vyas
Ranch Hand

Joined: Oct 23, 2006
Posts: 93
Oh it will? I didn't know that, I 'll give it a try.

Thanks!
Rhett Wang
Greenhorn

Joined: Apr 03, 2008
Posts: 12
Anirudh Vyas wrote:Hi,

I need oracle drivers for a maven project that i am working on. My question is how to install the drivers on the maven repository (local).
I am looking for complete command line thing for maven.I know that it goes something like:

mvn install:install-file -Dfile={Should i put complete path here?} -DgroupId=org.jdbc.OracleDriver <-- is this right?

I dont know what should come in artifact and version. Can someone give me the whole command line thing?

Any help would be appreciable.

Regards
Vyas, Anirudh



mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.3.0 -Dpackaging=jar -Dfile=ojdbc.jar

1 I would like use "CD" to make ojdbc.jar in the current folder, then I can just use -Dfile=ojdbc.jar
2 -DgroupId=com.oracle -DartifactId=ojdbc14

They just identify , you can use whatever you want. we'd better use com.oracle ;org.jdbc.OracleDriver or oracle for DgroupId


SCBCD in progress<br />SCWCD 5 (May 2008)<br />SCJP 2 (Aug 2001)
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Rhett, why are you responding to this post? The post is almost 2 years old and the already contained the solution to the original poster's question.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Oracle Drivers using Maven
 
Similar Threads
Error Compiling Maven Project
"Domino" project dependencies
Connecting to Oracle 7 thru jdbc
Maven 2 Surefire 2.4.3 tests always fail for forkmode pertest
Maven Setup