Maven: Including jar not found in public repository

前端 未结 6 1391
暖寄归人
暖寄归人 2020-12-02 07:23

If I was to use a 3rd party library that was not in the maven public repository, what is the best way to include it as dependency for my project so that when someone else ch

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-02 08:14

    This solution worked for me; 1. Created a local-maven-repo in my project's root directory and copied all my jars in the 2. Executed the following command to generate the necessary pom files and metadata etc for each and every jar that I needed to use;

    mvn deploy:deploy-file -DgroupId= -DartifactId= -Dversion=1.0.0 -Durl=file:./local-maven-repo/ -DrepositoryId=local-maven-repo -DupdateReleaseInfo=true -Dfile=

    This generated a new jar file with a pom file inside the local-maven-repo and I was able to include into my project as a dependency like this;

        
            somegroupid
            someartifact
            1.0.0
        
    

    Then mvn package ensured that my project dependencies are resolved and packaged with my war file.

提交回复
热议问题