I have 3 projects in the same directory. Project 1 can run on its own. Project 2 requires project 1. Project 3 requires project 2 and project 1.
I do not wish to upload the projects to a remote depository. So
Project 1 should build as normal. It should not know about other users of it or contain information about their builds.
Project 2 would require building/importing Project 1.
Project 3 would require building/importing Project 1 and 2 - or - Project 2 plus recursive dependencies.
The project 2 pom.xml looks like this:
<?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>
<groupId>com.project2</groupId>
<artifactId>project2</artifactId>
<version>1</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.project1</groupId>
<artifactId>project1</artifactId>
<version>1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<groupId>com.project1</groupId>
<artifactId>project1</artifactId>
<version>1</version>
<packaging>jar</packaging>
<file>${project.basedir}/../project1/target/project1-1.jar</file>
<pomFile>${project.basedir}/../project1/pom.xml</pomFile>
</configuration>
<executions>
<execution>
<id>install-project1-jar</id>
<goals>
<goal>install-file</goal>
</goals>
<phase>validate</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
That works.
The project 3 pom.xml looks like this:
<?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>
<groupId>com.project3</groupId>
<artifactId>project3</artifactId>
<version>1</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.project2</groupId>
<artifactId>project2</artifactId>
<version>1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<groupId>com.project2</groupId>
<artifactId>project2</artifactId>
<version>1</version>
<packaging>jar</packaging>
<file>${project.basedir}/../project2/target/project2-1.jar</file>
<pomFile>${project.basedir}/../project2/pom.xml</pomFile>
</configuration>
<executions>
<execution>
<id>install-project2-jar</id>
<goals>
<goal>install-file</goal>
</goals>
<phase>validate</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
That only retrieves dependencies for Project 2, the build does not find/retrieve dependencies for Project 1. It cannot find the pom.
How can I make maven find local dependencies more than one level up in the hierarchy of dependencies for the install-file plugin or for a different/better method?