How to tell M2Eclipse to install jar file as a maven dependency

前端 未结 2 633
误落风尘
误落风尘 2020-12-08 17:59

I want to add jpoller.jar as a maven dependency, so I edited my pom.xml file to include it:


    org.sadun

        
相关标签:
2条回答
  • 2020-12-08 18:30

    The install command automates the creation of a folder structure in ~/.m2 and pom.xml file for the dependency artifact. This can be done manually. OR You can simply copy the ~/.m2/{group}/{artifact} folder from a machine that does have mvn installed.

    Edit: This tool will help you find public repositories for a given dependency.

    Edit2: See http://maven.apache.org/guides/mini/guide-coping-with-sun-jars.html for an explination of the process of installing dependencies manually. Note that most sun jars are now available in the java.net repository http://download.java.net/maven/2/

    0 讨论(0)
  • 2020-12-08 18:38

    How can I do this from the M2Eclipse plugin on machines where the maven CLI isn't available?

    Well, simply do it from Eclipse. First, get that jpoller jar and save it somewhere on your file system. Then, in Eclipse, from the top bar, Run > Run Configurations... then right-click on Maven Build and configure the New_configuration freshly created:

    • Select an arbitrary Base directory
    • Fill the Goals with install:install-file
    • Add parameters for each required parameters, without the -D prefix (e.g. file as Parameter name and /path/to/file as Value and so on for groupId, artifactId,packaging and version).

    And run this configuration. Or... just install Maven.

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