maven


how we put the external jar's into our local maven repository


Here I am going to build a new java project and here the project need some external jar's which are need to be used repeatedly by different projects.How can we store the the external jar's into my local repository and access when when ever we need
'How can we set the dependency of particular jars in the pom.xml`.
You can follow this: Importing-jars, but I think you should work with a repository manager.
First, you should setup a local repository manager like Nexus or Artifactory to proxy external repositories and host your local artifacts.
Then with a simple command line execution like this one:
mvn deploy:deploy-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.1 -Dpackaging=jar -Dfile=c:\oracle_jdbc\jdk16_11.2.0.1\ojdbc6.jar -Durl=http://my-nexus/nexus/content/repositories/thirdparty -DrepositoryId=thirdparty
You upload the artifact to your repository manager (in my case it's Nexus).
From your pom, you can get the jar with declaring a new dependency:
<dependency>
<groupId>com.oracle</groupId>
<DartifactId>ojdbc6</DartifactId>
<version>11.2.0.1</version>
</dependency>
The initial call will add the jar from Nexus to your local .m2 (local repository) and be available to any other maven project needing it later on.
I hope this helps.
Here is a convenient method to pomify an external JAR (and only one)
The corresponding POM.XML file template is as follows. You have to change the project's groupId, artifactId, version and the property wrapped-lib-file and that's it. In the example, the external lib is supposed to be lib/external.jar.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>target-groupId</groupId>
<artifactId>target-artifactId</artifactId>
<version>target-version</version>
<packaging>jar</packaging>
<properties>
<wrapped-lib-file>lib/external.jar</wrapped-lib-file>
</properties>
<build>
<plugins>
<plugin>
<!-- Pomify the external JAR specified by ${wrapped-lib-file} -->
<inherited>false</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<id>Installation of wrapped library ${wrapped-lib-file}</id>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${wrapped-lib-file}</file>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<packaging>jar</packaging>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
You can then use this pomified JAR in dependencies of other projects (using the target's groupId, artifactId and version of course!)
If you are going to use obfuscated libs as Maven modules, this method will save you from great pain.

Related Links

why am i not able to download any dependancy from maven?
Error in running a spring batch war file
gradle download all dependencies from maven repo
phantomjs-maven-plugin : error Could not find a suitable constructor
Where to add Maven dependencies in a multi-module Vaadin project in NetBeans 8?
SBT unresolved dependency: com.paypal.sdk#paypal-core;LATEST
Expected GPG user ID for Maven Central artifacts?
Maven release from a branch by jenkins
how can i use elasticsearch 2.2.1 with apache camel
Maven and Jenkins - 'mvn' is not recognized as an internal or external command,
Automate Version Name in Install4j
Why does Maven not use my privatekey when deploying with scp?
Maven copy jars from network location
Goal specific javax.net.ssl.trustStore
Issue while creating eclipse p2 repository using maven tycho plugin
How to add Apache Maven to PATH permanently

Categories

HOME
ms-access
variables
cloud
reflection
activiti
server
tinymce
smarty
lodash
cvs
jira
analysis
rubygems
youtube-api-v3
ip
callback
serverspec
django-imagekit
constraint-programming
append
basic
u-sql
collectd
circular-dependency
decimal
jsprit
database-replication
connection-string
visual-composer
swingx
one-hot-encoding
abi
realex-payments-api
kudan
bootstrap-tour
microsoft-r
icloud-api
tdd
status
user-interaction
rst2pdf
elasticsearch-net
windows-server-2000
media-queries
stormpath
bcd
karaf
http-get
asset-pipeline
geopositioning
qwerty
starteam
hilbert-curve
streamreader
password-encryption
turbogears
node-sass
eclipse-gef
apache-fop
typescript1.8
tropo
darcs
gnome-shell-extensions
ctest
mongocsharpdriver
pagedlist
energy
intel-fortran
kcachegrind
responsive-images
web-controls
kineticjs
xc16
jscript.net
java.util.concurrent
cctv
asp.net-web-api-odata
phpthumb
comexception
message-driven-bean
dir
jmapviewer
bulkloader
rabl
clipper
referrer
path-separator
heartbeat
rfc1123
recent-documents
sql-server-profiler
radcombobox
getresponsestream
exchange-server-2003
ti-dsp
data-driven
project-hosting
thread-local-storage

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App