【问题标题】:jboss maven project add jar not exist in public repositoryjboss maven项目添加jar在公共存储库中不存在
【发布时间】:2017-07-02 09:42:45
【问题描述】:

我需要将 publi repo 中不存在的 jar 添加到我的 maven 项目中,我使用这样的系统范围:

<dependency>
  <groupId>test</groupId>
  <artifactId>test</artifactId>
  <version>X.Y.Z</version>
  <scope>system</scope>
  <systemPath>${user.home}/jars/my.jar</systemPath>
</dependency>

这个解决方案在本地机器上运行良好,但在远程服务器上却不行。当我用谷歌搜索时,我发现系统范围已经是一种不好的做法,所以还有另一种解决方案可以将 jar 添加到项目中?

【问题讨论】:

    标签: maven jboss


    【解决方案1】:

    这里有两个选择。

    第一

    <dependency>
      <groupId>test</groupId>
      <artifactId>test</artifactId>
      <version>X.Y.Z</version>
      <scope>system</scope>
      <systemPath>${project.basedir}/src/main/resources/yourJar.jar</systemPath>
    </dependency>
    

    第二

    在您的本地存储库中安装此 jar,它将包含在您构建的项目中。 您可以像这样在本地存储库中添加 jar:

        mvn install:install-file
       -Dfile=<path-to-file>
       -DgroupId=<group-id>
       -DartifactId=<artifact-id>
       -Dversion=<version>
       -Dpackaging=<packaging>
       -DgeneratePom=true
    
    Where: <path-to-file>  the path to the file to load
       <group-id>      the group that the file should be registered under
       <artifact-id>   the artifact name for the file
       <version>       the version of the file
       <packaging>     the packaging of the file e.g. jar
    

    编辑你的 pom.xml

     <dependency>
      <groupId>test</groupId>
      <artifactId>test</artifactId>
      <version>X.Y.Z</version>
    </dependency>
    

    【讨论】:

      猜你喜欢
      • 2010-11-24
      • 1970-01-01
      • 1970-01-01
      • 2013-03-03
      • 2012-03-17
      • 1970-01-01
      • 2011-09-17
      • 2014-08-31
      • 2016-06-23
      相关资源
      最近更新 更多