How do I add a jar file to my local Maven repository using Eclipse m2e on Luna Service (4.4.1)?

前端 未结 3 1339
旧时难觅i
旧时难觅i 2021-01-07 05:47

I am getting an warning message because I manually added a jar file to my local maven repository.

[INFO] Downloading: http://repo.maven.apache.org/maven2/com/netsu

相关标签:
3条回答
  • 2021-01-07 06:06

    You should add jar to your local repository like:

    mvn install:install-file -DgroupId=... -DartifactId=... -Dversion=... -Dpackaging=jar -Dfile=... -DgeneratePom=true
    

    -DgeneratePom=true genertes POM automatically...

    0 讨论(0)
  • 2021-01-07 06:22

    You need to declare <scope>system</scope> like

    <dependency>
        <groupId>com.netsuite</groupId>
        <artifactId>nsws-2014</artifactId>
        <version>1</version>
        <scope>system</scope>
        <systemPath>/path/to/your.jar</systemPath>
    </dependency>
    
    0 讨论(0)
  • 2021-01-07 06:31

    The local Maven repository is effectively a standard Maven repository; as such, it must adhere to a particular format (there are a few Maven-compatible repository formats).

    Dropping files into a repository isn't going to cut it, unless you are able to mimic the creation of additional artifacts in accordance to the Maven repository format that you use.

    The only foolproof way to do so would be to use the install:install-file goal, as specified here: http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

    To do this using m2e, you need to use a small hack. Create a Maven Launch configuration. In the "base directory" field, type in a value that will always resolve to a real directory, such as ${workspace_loc}. In the "Goals", field, type install:install-file, and then add the parameters (see the link in the paragraph below) in the "parameters" table (use the "Add" button to add parameters). Then run this launch configuration.

    0 讨论(0)
提交回复
热议问题