Create local maven repository

后端 未结 3 1344
Happy的楠姐
Happy的楠姐 2020-12-04 16:34

I want to create local maven repository. I did the following steps:

  1. Installed maven plugin in eclipse
  2. Created one folder localrepository in apache s
3条回答
  •  北荒
    北荒 (楼主)
    2020-12-04 16:52

    Set up a simple repository using a web server with its default configuration. The key is the directory structure. The documentation does not mention it explicitly, but it is the same structure as a local repository.

    To set up an internal repository just requires that you have a place to put it, and then start copying required artifacts there using the same layout as in a remote repository such as repo.maven.apache.org. Source

    Add a file to your repository like this:

    mvn install:install-file \
      -Dfile=YOUR_JAR.jar -DgroupId=YOUR_GROUP_ID 
      -DartifactId=YOUR_ARTIFACT_ID -Dversion=YOUR_VERSION \
      -Dpackaging=jar \
      -DlocalRepositoryPath=/var/www/html/mavenRepository
    

    If your domain is example.com and the root directory of the web server is located at /var/www/html/, then maven can find "YOUR_JAR.jar" if configured with http://example.com/mavenRepository.

提交回复
热议问题