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

Maven: Show comment/alert in console when a dependency is used (compile/package/…)
Remove filter in web.xml in jetty
How to execute code before TestNG for ie. building up the test suite
Reading a maven settings.xml when building with gradle?
Maven Nested Multi-module project
mvn clean package, I want to copy the created jar to the current directory
Merging configuration values in Maven
In Maven 3 how can I use project.version for the module as a dependency to another project
jmeter plugin maven test-jar
i am getting “Missing artifact groupId:artifactId:version:lifecycle ” while compiling the project
Best way to auto compile compass-style SASS via maven
How to configure multi-module Maven + Sonar + JaCoCo to give merged coverage report?
maven determine default lifecycle phase for plugin
Multiple errors staging a release in Maven?
Maven project not built pom.xml error
Maven: Can i have resources copied in WEB-INF and also in some other directory?

Categories

HOME
cloud
json.net
view
yarn
graphql
sharepoint-designer
windows-server
azure-media-services
podio
paradox
windows-10-universal
spring-xd
usergrid
ibm-odm
flask-wtforms
foselasticabundle
highlight.js
flux
excel-vba-mac
lucene.net
nodatime
facebook-instant-articles
excel-2007
kudan
language-agnostic
rundeck
tdd
url-scheme
elasticsearch-ruby
webkitspeechrecognition
bpel
skia
javascriptcore
key-value-observing
http-referer
atl
mmenu
nssegmentedcontrol
stacked
hot-module-replacement
serverside-rendering
hue
outlook-api
acoustics
menuitem
parentheses
atomicity
sage-one
yii2-extension
elgg
tactic
composite-key
qtwebview
bind9
abcpdf9
oauth2client
browser-link
google-places
sdhc
citrus-pay
libressl
cakephp-3.1
splash
sniffer
offloading
angularjs-ng-click
titanium-modules
mesa
kgdb
datagridviewcolumn
typo3-neos
mbr
gnu-smalltalk
multiprocessor
type-equivalence
clipper
kyotocabinet
runas
buildr
amazon-appstore
genshi
yetanotherforum
site.master
google-friend-connect
h.323
paster
wise
firefox-5
microsoft-virtualization
adrotator
simpletest
pascal-fc
genealogy
ugc

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