Can I add jars to maven 2 build classpath without installing them?

前端 未结 24 2878
萌比男神i
萌比男神i 2020-11-22 01:41

Maven2 is driving me crazy during the experimentation / quick and dirty mock-up phase of development.

I have a pom.xml file that defines the dependenc

24条回答
  •  轮回少年
    2020-11-22 02:06

    To install the 3rd party jar which is not in maven repository use maven-install-plugin.

    Below are steps:

    1. Download the jar file manually from the source (website)
    2. Create a folder and place your jar file in it
    3. Run the below command to install the 3rd party jar in your local maven repository

    mvn install:install-file -Dfile= -DgroupId= -DartifactId= -Dversion= -Dpackaging=

    Below is the e.g one I used it for simonsite log4j

    mvn install:install-file -Dfile=/Users/athanka/git/MyProject/repo/log4j-rolling-appender.jar -DgroupId=uk.org.simonsite -DartifactId=log4j-rolling-appender -Dversion=20150607-2059 -Dpackaging=jar

    1. In the pom.xml include the dependency as below

         
              uk.org.simonsite
              log4j-rolling-appender
              20150607-2059 
        
      
    2. Run the mvn clean install command to create your packaging

    Below is the reference link:

    https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

提交回复
热议问题