のために間違ったディレクトリを見て、私持っている子供pom.xml
次:私はそれは私のローカルリポジトリ(.m2/repository
)にjavax.vecmath
をインストールするMavenは依存関係
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>runtime_shared</groupId>
<artifactId>runtime_shared.master</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>runtime_shared</groupId>
<artifactId>javax.vecmath</artifactId>
<name>javax.vecmath</name>
<version>1.0.0.qualifier</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<id>vecmath</id>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${basedir}/vecmath.jar</file>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<packaging>jar</packaging>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
。後で私はこのように私の親pom.xml
でこれを指定します。
<dependency>
<groupId>runtime_shared</groupId>
<artifactId>javax.vecmath</artifactId>
<version>1.0.0.qualifier</version>
</dependency>
をしかし、私はmvn install -X
を行うときに、私のような、その達人は全く異なる道を探し見ること:明らかに
[DEBUG] /home/usr/workspace_runtime/runtime_shared/javax.vecmath/target/javax.vecmath-1.0.0.qualifier.jar
とエラーが発生します。何らかの環境変数が間違って設定されているか、または<file>${basedir}/vecmath.jar</file>
タグのためにですか?${basedir}
は何とか何かを参照していますか?私も${project.basedir}
を使ってみましたが、うまくいきませんでした。ここでは、鮮明な画像を得ることが
は別のケースです:
[DEBUG] /home/usr/.m2/repository/x/org.apache.felix.main/1.0.0/org.apache.felix.main-1.0.0.jar
[DEBUG] /home/usr/.m2/repository/x/org.apache.felix.gogo/0.10.0/org.apache.felix.gogo-0.10.0.jar
[DEBUG] /home/usr/workspace_runtime/x/com.google.protobuf/target/com.google.protobuf-2.5.0.jar
あなたが気付いた場合は、最初の二つのプロジェクトのディレクトリが正しいです。しかし、最後のものは、何とか間違ったディレクトリの下に見えます。その結果:
package com.google.protobuf does not exist
お勧めはありますか?あなたとMavenプロジェクトを宣言すると
'maven-install-plugin'のこの設定を削除します。あなたは' mvn clean install'を起動するだけです。 – Tunaki
次に、jarファイルをどのようにローカルリポジトリに追加しますか?私が気づいたら、設定セクションのjarを参照してください。 –
'install'はあなたのローカルレポに自動的にjarをインストールします。 – Tunaki