I have multi module project. I want to make an executable jar from one of this modules. root pom is
<groupId>ru.netCracker</groupId>
<artifactId>root</artifactId>
<!--todo:Version-->
<version>1.1.0</version>
<packaging>pom</packaging>
<properties>...</properties>
<modules>
<module>client</module>
<module>serverRoot</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
In child pom is specified jar packaging settings and some dependencies.
<artifactId>client</artifactId>
<!--todo:Version-->
<version>1.1.0</version>
<parent>
<groupId>ru.netCracker</groupId>
<artifactId>root</artifactId>
<version>1.1.0</version>
</parent>
<properties>
<maven.jar.version>3.0.2</maven.jar.version>
<jfoenix.version>1.11.1</jfoenix.version>
</properties>
<dependencies>
<dependency>
<groupId>ru.netCracker</groupId>
<artifactId>root</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven.jar.version}</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>sample.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
But maven compiler says:
[ERROR] Failed to execute goal on project client: Could not resolve dependencies for project ru.netCracker:client:jar:1.1.0: Failure to find ru.netCracker:root:jar:1.1.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
What commands have I to write to maven to package this jar?
Maven is simply complaining that it can't find the dependency for root
module as it hasn't been built yet.
I suggest to make following changes -
Change your parent tag in client
module to
<parent>
<groupId>ru.netCracker</groupId>
<artifactId>root</artifactId>
<version>1.1.0</version>
<relativePath>../</relativePath>
</parent>
Remove following code since you have root
as your parent.
<dependencies>
<dependency>
<groupId>ru.netCracker</groupId>
<artifactId>root</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>