2017-07-02 8 views
0

jarファイルを追加します。のJBoss Mavenプロジェクト私は私はこのようなシステムスコープを使用している私のMavenプロジェクトにpubliレポには存在しないjarファイルを追加する必要が公開リポジトリに存在しませ

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

このソリューションは正常に動作してローカルマシンに遠いサーバーではありません。私はGoogleのとき、私はシステムスコープがaleardy悪い練習であることがわかりますので、プロジェクトにjarファイルを追加する別の解決策がありますか?

答えて

0

ここには2つのオプションがあります。

まず

<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ファイルをインストールし、それはあなたに構築プロジェクトに含まれます。

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> 
:あなたはあなたの中にこのようなローカルリポジトリをjarファイルを追加することができます
関連する問題