このアプローチはお勧めしませんが、POM 構成を追加して、サードパーティの依存関係を別のプロファイルにインストールできます。
<profiles>
<profile>
<id>install-dependencies</id>
<build>
<plugins>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<id>install-dropbox-sdk</id>
<phase>validate</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>com.dropbox</groupId>
<artifactId>dropbox-sdk</artifactId>
<version>1.3.1</version>
<file>src/main/lib/dropbox-java-sdk-1.3.1.jar</file>
<packaging>jar</packaging>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>build</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>com.dropbox</groupId>
<artifactId>dropbox-sdk</artifactId>
<version>1.3.1</version>
</dependency>
</dependencies>
</profile>
</profiles>
ここには と の 2 つのプロファイルがありinstall-dependencies
ますbuild
。1 つ目は依存関係を Maven リポジトリにインストールし、dropbox-sdk
次のようにすべてのマシンで 1 回実行する必要があります。
mvn -Pinstall-dependencies validate
2 つ目はデフォルトで有効になっており、Dropbox SDK を依存関係として追加します。
正直なところ、これは実行するよりもはるかに優れているわけではありません
mvn install:install-file -Dfile=src/main/lib/dropbox-java-sdk-1.3.1.jar -DgroupId=com.dropbox -DartifactId=dropbox-sdk -Dversion=1.3.1 -Dpackaging=jar
すべてのマシンで。
このアプローチのもう 1 つの欠点はdropbox-sdk
、ビルドにすべての依存関係を追加する必要があることです。一方、JAR と POM をリポジトリ サーバーに追加して適切に実行すると、Maven は推移的な依存関係を適切に計算します。 .