I do not recommend this approach, but you can add some POM configuration to install third-party dependencies in a separate profile:
<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>
There are two profiles here: install-dependencies
and build
. The first installs the dropbox-sdk
dependency in your Maven repository and should be run once on each computer as follows:
mvn -Pinstall-dependencies validate
The second is enabled by default and adds the Dropbox SDK as a dependency.
To be honest, this is not much better than starting
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
on each machine.
Another drawback of this approach is that you will have to add all the dropbox-sdk
dependencies to your assembly, whereas if you do it right by adding JAR and POM to the repository server, Maven will correctly calculate the transitive dependencies.
Kkkev source share