手动安装jar文件

时间:2016-09-02 14:10:09

标签: java maven jitpack

手动将jar文件安装到存储库中。

我想将此SDK安装为maven依赖项。

https://developer.intuit.com/docs/0100_quickbooks_online/0400_tools/0005_accounting/0200_java/0002_installing_the_java_sdk_for_quickbooks

我试过了:

mvn install:install-file -DgroupId=com.intuit.code.devkit.v3 -DartifactId=ipp-v3-java-devkit -Dversion=2.5.0 -Dpackaging=jar -Dfile=c:\lib\ipp-java-qbapihelper-1.2.1-jar-with-dependencies.jar

但是我得到了

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing c:\lib\ipp-java-qbapihelper-1.2.1-jar-with-dependencies.jar to C:\Users\plamen\.m2\repository\com\intuit\code\devkit\v3\ipp-v3-java-devkit\2.5.0\ipp-v3-java-devkit-2.5.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.631 s
[INFO] Finished at: 2016-09-02T17:04:51+03:00
[INFO] Final Memory: 7M/123M
[INFO] ------------------------------------------------------------------------

当我浏览本地存储库时,我无法在目录中找到任何jar文件。有人可以给我一些建议吗?

1 个答案:

答案 0 :(得分:1)

我过去做过的工作是:

  • 将感兴趣的jar文件复制到临时文件夹,即项目root / tmp
  • 从项目根目录运行命令行中的以下命令(相应地调整参数):

    mvn install:install-file -Dfile=tmp/<filename>.jar -DgroupId=intuit.code.devkit.v3 -DartifactId=ipp-v3-java-devkit -Dversion=2.5.0 -Dpackaging=jar -DlocalRepositoryPath=<repo path> (i.e. src/dependencies/jars)
    
  • 在那个命令之后你应该看到一个src / dependencies / jars / com / ...目录下面有maven工件

  • 为pom.xml添加依赖关系

    <!— <project> is the parent element —>
    <repositories>
        <repository>
            <id>system-jars</id>
            <url>file://${basedir}/src/dependencies/jars</url>
        </repository>
    </repositories>
    <!— Add the dependency —>
    <dependency>
        <groupId>com.intuit.code.devkit.v3</groupId>
        <artifactId>ipp-v3-java-devkit</artifactId>
        <version>2.5.0</version>
    </dependency>
    
  • 执行maven clean和package。验证类是否包含在结束工件中,然后在一切正确后删除tmp目录。