How to add local jar files to a Maven project?

后端 未结 30 3330
悲&欢浪女
悲&欢浪女 2020-11-21 04:58

How do I add local jar files (not yet part of the Maven repository) directly in my project\'s library sources?

30条回答
  •  鱼传尺愫
    2020-11-21 05:31

    Create a new folder, let's say local-maven-repo at the root of your Maven project.

    Just add a local repo inside your of your pom.xml:

    
        
            local-maven-repo
            file:///${project.basedir}/local-maven-repo
        
    
    

    Then for each external jar you want to install, go at the root of your project and execute:

    mvn deploy:deploy-file -DgroupId=[GROUP] -DartifactId=[ARTIFACT] -Dversion=[VERS] -Durl=file:./local-maven-repo/ -DrepositoryId=local-maven-repo -DupdateReleaseInfo=true -Dfile=[FILE_PATH]
    

提交回复
热议问题