Reputation: 414
I'm trying to create a test project on microservices. I took another project as a basis. Here is the structure of the project:
octory
--common
--proxy-service
--content
At the root of the project, I created the main pom.xml
<groupId>ru.octory.marketplace</groupId>
<artifactId>octory</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.12</version>
<relativePath/>
</parent>
<modules>
<module>content</module>
<module>common</module>
<module>proxy-service</module>
</modules>
pom.xml common module
<parent>
<artifactId>octory</artifactId>
<groupId>ru.octory.marketplace</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>common</artifactId>
<version>1.0-SNAPSHOT</version>
<name>common</name>
<description>Common MicroService</description>
<properties>
<java.version>14</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
pom.xml proxy-service module
<parent>
<artifactId>octory</artifactId>
<groupId>ru.octory.marketplace</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>proxy-service</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>proxy-service</name>
<description>Proxy-service MicroService</description>
<properties>
<java.version>14</java.version>
<common.version>1.0-SNAPSHOT</common.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>ru.octory.marketplace</groupId>
<artifactId>common</artifactId>
<version>${common.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.2</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<finalName>proxy</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
</build>
The common module was assembled without errors. But when I run mvn clean install in the proxy-service module, an error occurs:
[ERROR] Failed to execute goal on project proxy-service: Could not resolve dependencies for project ru.octory.marketplace:proxy-service:jar:1.0-SNAPSHOT: Failed to collect dependencies at ru.octory.marketplace:common:jar:1.0-SNAPSHO
T: Failed to read artifact descriptor for ru.octory.marketplace:common:jar:1.0-SNAPSHOT: Could not find artifact ru.octory.marketplace:octory:pom:1.0-SNAPSHOT
This is the first time I'm trying to create a project on microservices and I'm completely confused about dependencies. What did I do wrong?
Upvotes: 0
Views: 39
Reputation: 414
Deleting the folder with local repositories /home/<user_name>/.m2 helped Only after that the error went away.
Upvotes: 1