How to add local jar files to a Maven project?

后端 未结 30 3247
悲&欢浪女
悲&欢浪女 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:10

    You can add local dependencies directly (as mentioned in build maven project with propriatery libraries included) like this:

    
        com.sample
        sample
        1.0
        system
        ${project.basedir}/src/main/resources/Name_Your_JAR.jar
    
    

    Update

    In new releases this feature is marked as deprecated but still working and not removed yet ( You just see warning in the log during maven start). An issue is raised at maven group about this https://issues.apache.org/jira/browse/MNG-6523 ( You can participate and describe why this feature is helpful in some cases). I hope this feature remains there!

    If you are asking me, as long as the feature is not removed, I use this to make dependency to only one naughty jar file in my project which is not fit in repository. If this feature is removed, well, there are lots of good answers here which I can chose from later!

提交回复
热议问题