How to include custom library into maven local repository?

For Java libraries that are not available in the Maven Central or other Maven repositories, we need to install it into our Maven Local repository in order to use it as a project dependencies.

In this tutorial, we will show you how to install the kaptcha jar into our Maven local repository.

1. Kaptcha

For example, kaptcha, a popular third party Java library, which is generating captcha image to stop spam, but it’s not available in the Maven center repository.

Update
Now, the kaptcha is available in the Maven Central Repository. It is fine, even it is in the Maven Central, we still can install the Kaptcha JAR file manually into our Maven local repository.

2. mvn install

Download the kaptcha, extract it and copy the kaptcha-${version}.jar to somewhere else, for example, C drive, and run this command:


$ mvn install:install-file -Dfile=c:\kaptcha-{version}.jar -DgroupId=com.google.code 
	-DartifactId=kaptcha -Dversion={version} -Dpackaging=jar

For example:


> mvn install:install-file -Dfile=c:\kaptcha-2.3.jar -DgroupId=com.google.code 
-DartifactId=kaptcha -Dversion=2.3 -Dpackaging=jar

[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'install'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [install:install-file] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [install:install-file]
[INFO] Installing c:\kaptcha-2.3.jar to 
D:\maven_repo\com\google\code\kaptcha\2.3\kaptcha-2.3.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Tue May 12 13:41:42 SGT 2009
[INFO] Final Memory: 3M/6M
[INFO] ------------------------------------------------------------------------

Done, the kaptcha jar is installed (copied) into our Maven local repository.

3. pom.xml

After installed, just declares the kaptcha dependency as usual.

pom.xml

	<dependency>
		  <groupId>com.google.code</groupId>
		  <artifactId>kaptcha</artifactId>
		  <version>2.3</version>
	 </dependency>

4. Alternative Solution

Forget about the ‘mvn install`, we also can download the .jar and tell the project to find the .jar in the system path like this:

pom.xml

	<dependency>
		<groupId>com.google.code</groupId>
		<artifactId>kaptcha</artifactId>
		<version>2.3</version>
		<scope>system</scope>
		<systemPath>d:/projects/kaptcha.jar</systemPath>
	</dependency>
pom.xml

	<dependency>
		<groupId>com.google.code</groupId>
		<artifactId>kaptcha</artifactId>
		<version>2.3</version>
		<scope>system</scope>
		<systemPath>${project.basedir}/lib/kaptcha.jar</systemPath>
	</dependency>

References

62 comments on “How to include custom library into maven local repository?

  1. Awesome. The <dependencies> tags are needed though .eg:
    
          <dependencies>
                <dependency>
                  <groupId>com.google.code</groupId>
                  <artifactId>kaptcha</artifactId>
                  <version>2.3</version>
                  <scope>system</scope>
                  <systemPath>${project.basedir}/lib/kaptcha.jar</systemPath>
              </dependency>
          </dependencies>
    
    the jar file must be "kaptcha-2.3.jar" on the system path
    
    Reply
  2. Hi,
    i just have file pom.xml onlinux

    viettelsecurity
    viettelsecurity
    2.0
    system
    ${project.basedir}/lib/viettelsecurity2.0.jar

    but output show
    [WARNING] ‘dependencies.dependency.systemPath’ for viettelsecurity:viettelsecurity:jar should not point at files within the project directory, ${project.basedir}/lib/viettelsecurity2.0.jar will be unresolvable by dependent projects @ line 119, column 16

    so local lib can not import my file war
    can you help me fix this? thanks

    Reply
  3. I had to copy my custom jar at “${project.basedir}/src/main/webapp/WEB-INF/lib” & specify that as “systemPath” in pom.xml in order to get this jar included in my war file which is created by mvn install. This was not done automatically if my custom jar is located somewhere else.

    Reply
  4. It doesn’t work for me and sorry for this log errors

    C:\PostEvent\workspace\geostatus>mvn install:install-file -Dfile=C:/PostEvent/workspace/geostatus/sr
    c/main/resources/libxldkkdkdkkd -DgroupeId=ebx -DartifactId=ebx -Dversion=5.9.3 -Dpackaging=jar -Dge
    neratePom=truemvn install:install-file -Dfile=C:/PostEvent/workspace/geostatus/src/main/resources/li
    b -DgroupeId=ebx -DartifactId=ebx -Dversion=5.9.3 -Dpackaging=jarmvn install:install-file -Dfile=C:/
    PostEvent/workspace/geostatus/src/main/resources/lib/ebx.jar -DgroupeId=ebx -DartifactId=ebx -Dversi
    on=5.9.3 -Dpackaging=jar
    [INFO] Scanning for projects…
    Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-eclips
    e-plugin/2.9/maven-eclipse-plugin-2.9.pom
    [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-eclipse-plugin:2.9
    : Plugin org.apache.maven.plugins:maven-eclipse-plugin:2.9 or one of its dependencies could not be r
    esolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-eclipse-plugin:jar:2.
    9
    Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-shade-
    plugin/1.6/maven-shade-plugin-1.6.pom
    [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-shade-plugin:1.6:
    Plugin org.apache.maven.plugins:maven-shade-plugin:1.6 or one of its dependencies could not be resol
    ved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-shade-plugin:jar:1.6
    Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-war-pl
    ugin/2.1.1/maven-war-plugin-2.1.1.pom
    [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-war-plugin:2.1.1:
    Plugin org.apache.maven.plugins:maven-war-plugin:2.1.1 or one of its dependencies could not be resol
    ved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-war-plugin:jar:2.1.1
    Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-
    plugin/2.5/maven-clean-plugin-2.5.pom
    [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.5:
    Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resol
    ved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
    Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resour
    ces-plugin/2.6/maven-resources-plugin-2.6.pom
    [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-resources-plugin:2
    .6: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not
    be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:
    jar:2.6
    Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-surefi
    re-plugin/2.12.4/maven-surefire-plugin-2.12.4.pom
    [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-surefire-plugin:2.
    12.4: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies could
    not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-surefire-plug
    in:jar:2.12.4
    Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-instal
    l-plugin/2.4/maven-install-plugin-2.4.pom
    [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-install-plugin:2.4
    : Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be r
    esolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-install-plugin:jar:2.
    4
    Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-deploy
    -plugin/2.7/maven-deploy-plugin-2.7.pom
    [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-deploy-plugin:2.7:
    Plugin org.apache.maven.plugins:maven-deploy-plugin:2.7 or one of its dependencies could not be res
    olved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-deploy-plugin:jar:2.7
    Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-site-p
    lugin/3.3/maven-site-plugin-3.3.pom
    [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-site-plugin:3.3: P
    lugin org.apache.maven.plugins:maven-site-plugin:3.3 or one of its dependencies could not be resolve
    d: Failed to read artifact descriptor for org.apache.maven.plugins:maven-site-plugin:jar:3.3
    Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-antrun
    -plugin/1.3/maven-antrun-plugin-1.3.pom
    [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-antrun-plugin:1.3:
    Plugin org.apache.maven.plugins:maven-antrun-plugin:1.3 or one of its dependencies could not be res
    olved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-antrun-plugin:jar:1.3
    Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-assemb
    ly-plugin/2.2-beta-5/maven-assembly-plugin-2.2-beta-5.pom
    [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-assembly-plugin:2.
    2-beta-5: Plugin org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5 or one of its dependencie
    s could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-assem
    bly-plugin:jar:2.2-beta-5
    Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-depend
    ency-plugin/2.8/maven-dependency-plugin-2.8.pom
    [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-dependency-plugin:
    2.8: Plugin org.apache.maven.plugins:maven-dependency-plugin:2.8 or one of its dependencies could no
    t be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-dependency-plug
    in:jar:2.8
    Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-releas
    e-plugin/2.5.3/maven-release-plugin-2.5.3.pom
    [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-release-plugin:2.5
    .3: Plugin org.apache.maven.plugins:maven-release-plugin:2.5.3 or one of its dependencies could not
    be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-release-plugin:ja
    r:2.5.3
    Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
    Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metada
    ta.xml
    [WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (h
    ttps://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/15
    1.101.16.215] failed: Connection refused: connect
    [WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (https://
    repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.1
    6.215] failed: Connection refused: connect
    [WARNING] Failure to transfer org.apache.maven.plugins/maven-metadata.xml from https://repo.maven.ap
    ache.org/maven2 was cached in the local repository, resolution will not be reattempted until the upd
    ate interval of central has elapsed or updates are forced. Original error: Could not transfer metada
    ta org.apache.maven.plugins/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2
    ): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.16.215] failed: Connection re
    fused: connect
    [WARNING] Failure to transfer org.codehaus.mojo/maven-metadata.xml from https://repo.maven.apache.or
    g/maven2 was cached in the local repository, resolution will not be reattempted until the update int
    erval of central has elapsed or updates are forced. Original error: Could not transfer metadata org.
    codehaus.mojo/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Connect to
    repo.maven.apache.org:443 [repo.maven.apache.org/151.101.16.215] failed: Connection refused: connect

    [INFO] ————————————————————————
    [INFO] BUILD FAILURE
    [INFO] ————————————————————————
    [INFO] Total time: 27.031 s
    [INFO] Finished at: 2019-06-14T18:23:34+02:00
    [INFO] ————————————————————————
    [ERROR] No plugin found for prefix ‘install’ in the current project and in the plugin groups [org.ap
    ache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\bachiramazig
    h.badjad\.m2\repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following arti
    cles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

    Reply
  5. Hi, Mkyong. I would like to know if you have an example of add external JAR to the maven project but taking into account that this JAR has a NATIVE LIBRARY dependency. As the case of include OpenCV Library in a Maven Project.

    Reply
  6. Hi,
    I have a spring boot app say A, which I am using in other spring boot app say B as Maven dependency, the above process is working, but when I modify anything in app A manually I have to run mvn package and by above process I’ve to include the jar in local repo, is there any automated process, if I modify app A automatically it gets updated in Maven local repo.

    Reply
  7. Can’t we just copy the jar file directly into Maven local repository?

    Reply
  8. The problem I’m facing after this is the following error:

    [WARNING] The POM for pipapo.jar is missing, no dependency information availalable

    Obviously there is no POM because the other project had nothing to do with maven. So how do I get rid of these errors?

    Reply
    1. Maven install file should generate the pom file automatically. Try upgrade Maven to the latest 3.6, and test it again.

      Reply
  9. Thanks for the post. I’m trying this but looks like it did
    not work for me.

    I’m creating a library a project and copied the jar to
    c:mylibtest-automation-library-0.0.1-SNAPSHOT.jar

    I’m running the test scripts through Jenkins.

    In the Jenkins job of test scripts, I included the following
    pre-build step install the library:

    install:install-file
    -Dfile=c:mylibtest-automation-library-0.0.1-SNAPSHOT.jar
    -DgroupId=com.mycompany.taf -DartifactId=test-automation-library
    -Dversion=0.0.1 -Dpackaging=jar
    This installs the jar to maven local repository (where are
    the scripts are supposed to run) and build is successful

    in the POM file of the test-scripts, I included the
    following dependency for the above library:

    com.mycompany.taf

    test-automation-library

    0.0.1-SNAPSHOT

    If I do maven install through Jenkins, I’m hitting the
    following error:

    [INFO]
    ————————————————————————

    [WARNING] The POM for
    com.mycompany.taf:test-automation-library:jar:0.0.1-SNAPSHOT is missing, no
    dependency information available

    [INFO] ————————————————————————

    [INFO] BUILD FAILURE

    Is it something wrong with the dependency? I tried the with
    all different options and also googled it, but could not able to figured out
    what was the problem. I’m really blocked here. any help/pointers are greatly
    appreciated.

    Thanks in advance.

    Rams.

    Reply
  10. Hi,

    am try to build my maven project…but i got an error

    Failed to read artifact descriptor for org.fusesource.jansi:jansi:jar:1.1: Could not transfer artifact org.fusesource.jansi:jansi:pom:1.1 from/to jansi (http://jansi.fusesource.org/repo/release): Connection to http://jansi.fusesource.org refused: Connection timed out

    bcse..jansi.pom file now available only in http://repo.fusesource.org/repo/release

    am just install jansi.pm file in my local repository folder(following u r website) …
    but again got same error,…how to fix it,…???

    Reply
  11. To generate the pom automatically just add -DgeneratePom=true to the command

    Reply
  12. hi..

    I’m getting follwing error.please what can i do for that?

    run code

    mvn install:install-file -Dfile=~//Desktop//kaptcha-2.3.2.jar -DgroupId=com.google.code -DartifactId=kaptcha -Dversion=2.3.2 -Dpackaging=jar

    error

    [INFO] ————————————————————————

    [INFO] BUILD FAILURE

    [INFO] ————————————————————————

    [INFO] Total time: 6.279s

    [INFO] Finished at: Sun Jul 27 19:36:31 IST 2014

    [INFO] Final Memory: 6M/90M

    [INFO] ————————————————————————

    [ERROR] No plugin found for prefix ‘install’ in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/home/samith/.m2/repository), central (http://search.maven.org/)] -> [Help 1]

    [ERROR]

    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

    [ERROR] Re-run Maven using the -X switch to enable full debug logging.

    [ERROR]

    [ERROR] For more information about the errors and possible solutions, please read the following articles:

    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

    Reply
    1. sorry the -Dfile as follows without double slash
      -Dfile=~/Desktop/kaptcha-2.3.2.jar

      Reply
  13. I recently created a small UI util to install libraries in the local repository. It does the same as described in the article. The name is: maven-install-ui and can be found on github

    Reply
  14. I did like that but im getting:
    missing artifact

    Reply
  15. Hi,mkyong, I am installing ojdbc6.jar to my local repository, the install command is just like you write in article and ojdbc6.jar is copied to local repo, then I try to search this artifact in eclipse pom Dependencies panel, I can’t find this artifact, I try to add in pom.xml manually, it works. So what can I do to make sure I can search out this newly installed artifact? My command line maven and eclipse maven use the same local repository.

    Reply
  16. What is that you haven’t still written about! I found an article for everything I look around for! Thanks!

    Reply
  17. Hi mkyong,

    I can not install any one plugin into my local repository, and I don´t know why.

    Into cmd:

    C:\>mvn install:install-file -Dfile=c:\maven-clean-plugin-2.4.1.jar -Dgroupid=or
    g.apache.maven.plugins -DartefactId=maven-clean-plugin -Dversion=2.4.1 -Dpackagi
    ng=jar
    [INFO] Scanning for projects…
    Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
    clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
    14-dic-2012 16:39:54 org.apache.maven.wagon.providers.http.httpclient.impl.clien
    t.DefaultRequestDirector tryExecute
    INFO: I/O exception (java.net.SocketException) caught when processing request: C
    onnection reset

    Reply
  18. Hi,

    I followed the steps you mentioned.

    Step 1: using wsimport I generate the class file
    Step 2: using jar -cvf command I create a jar named TestClient.jar
    Step 3: From the same directory I issued the command like:

    mvn install:install-file -Dfile= /Users/Jayaram/TestClient/FriendsMirrorRegisterClient.jar -DgroupId=com.friendsmirror.register.ws.client -DartifactId=friendsMirrorRegisterClient -Dversion=0.1 -Dpackaging=jar

    OutPut:

    [INFO] Scanning for projects…
    [INFO] ————————————————————————
    [INFO] BUILD FAILURE
    [INFO] ————————————————————————
    [INFO] Total time: 0.108s
    [INFO] Finished at: Sun Jun 24 16:13:36 GMT+05:30 2012
    [INFO] Final Memory: 2M/81M
    [INFO] ————————————————————————
    [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/Users/Jayaram/TestClient). Please verify you invoked Maven from the correct directory. -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException

    I tried to run the same command from a maven based project directory where pom.xml is located and getting the below out put:

    [INFO] Scanning for projects…
    [INFO]
    [INFO] ————————————————————————
    [INFO] Building FriendsMirrorWAR Maven Webapp 0.0.1-SNAPSHOT
    [INFO] ————————————————————————
    [INFO]
    [INFO] — maven-install-plugin:2.3.1:install-file (default-cli) @ FriendsMirrorWAR —
    [INFO] Installing /Users/Jayaram/Program/FriendsMirrorWAR to /Users/Jayaram/mavenrepo/com/friendsmirror/register/ws/client/friendsMirrorRegisterClient/0.1/friendsMirrorRegisterClient-0.1.jar
    [INFO]
    [INFO] ————————————————————————
    [INFO] Skipping FriendsMirrorWAR Maven Webapp
    [INFO] This project has been banned from the build due to previous failures.
    [INFO] ————————————————————————
    [INFO] ————————————————————————
    [INFO] BUILD FAILURE
    [INFO] ————————————————————————
    [INFO] Total time: 0.781s
    [INFO] Finished at: Sun Jun 24 16:09:52 GMT+05:30 2012
    [INFO] Final Memory: 3M/81M
    [INFO] ————————————————————————
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file (default-cli) on project FriendsMirrorWAR: Error installing artifact ‘com.friendsmirror.register.ws.client:friendsMirrorRegisterClient:jar’: Failed to install artifact com.friendsmirror.register.ws.client:friendsMirrorRegisterClient:jar:0.1: /Users/Jayaram/Program/FriendsMirrorWAR (No such file or directory) -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

    I tried to google out for the same but not yet good luck.

    Could you please help out on this.

    Thaks

    Reply
    1. this command works fine when run in plain cmd instead of win powershell

      Reply
    2. Hi, I’ve following scenario with jenkins, i’m able to run custom jars via command prompt using maven but when I configure any maven or free style job then job is failing due to following error-
      ERROR] Failed to execute goal on project ConnectorAutomation: Could not resolve dependencies for project com.cisco.connector.tests:ConnectorAutomation:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: ere:ere-core-api:jar:9.0.10, Could not find artifact aie:aie-core-api:jar:4.0.10 in central (http://repo.maven.apache.org/maven2) -> [Help 1]
      [ERROR]

      How to resolve such error to use in full cycle phase?

      Reply
  19. Hi All,
    Can any one tell me what is the purpose of groupId,arifactId tag in dependency tag and -Dpackaging property in the mvn command ………

    Reply
  20. Hi All,
    Can any one tell me what is the purpose of , in tag and -Dpackaging property in the mvn command ………

    Reply
  21. For me works this:

    mvn install:install-file -DgroupId=com.google.code.kaptcha -DartifactId=kaptcha -Dversion=2.3 -Dpackaging=jar -Dfile=kaptcha-2.3.jar

    instead of “…-DgroupId=com.google.code … “

    Reply
  22. Hi,
    I have a requirement in which I have to uplaod the internally created jar(project related) to repo without version.
    Please sujjest how to do that.
    Thanks!! 🙂

    Reply
  23. Great, you are so good to explain things in a simple manner. How do we do the same if I have to install a library or project to nexsus repository?

    Reply
    1. Sorry, never use nexsus. But, nexsus should have a screen to let user to add the library manually, try search it.

      Reply
  24. How to create custom project structure with Maven (step by step mkyong style).

    Thank you,
    Praneeth.

    Reply
  25. Hi! Thank you for tutorial but how can I add a jar library that uses native external libraries (.dll, .so)?

    Reply
    1. I don’t think Maven cant handle it automatically. You can still use Maven to add Java library but put your .dll or .so manually into project classpath.

      Reply
  26. thanx alot it made simple to add my own jar and not to place into nexus.

    Reply
    1. Yeah, but sometimes you need to add it into Nexus (so other people can use it in your organization, for example).

      Reply
        1. Hi mkyong,
          Thanks for such wonderful maven tutorials.

          Reply
  27. Thanks a lot!!!!!
    it was really a great. Simple and easy as everything must be.

    Reply
  28. Make sure to add -Dpackaging=jar to that mvn:install command. This parameter is not optional. (In your instructions, it appears in the result section, but not in the command)

    Reply
    1. hi -Dpackaging=jar is a must in order for the install the mavan library manually into our local repository. Post is updated , thanks for it.

      Reply
      1. I Have one problem. This command is ok for a single Custom jar file. But we have 17 custom jars files in the file system. I do not want to write dependency in pom.xml file for each and every jars instead inside one dependecy through which all the jars will be available to build patha. Is there any way to to this. Please suggest me.

        Reply

Leave a Comment

Your email address will not be published. Required fields are marked *