1

I have a common module that I load into my other 3 modules. When I run the project, everything works, but when I try to make Install, I get the error:

com.example.common.dto does not exist 

I connect commons like this:

 <dependency> <groupId>com.example</groupId> <artifactId>commons</artifactId> <version>1.1-SNAPSHOT</version> <scope>compile</scope> </dependency> 

Commons Pom:

<?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.example</groupId> <artifactId>nexign-task</artifactId> <version>1.0-SNAPSHOT</version> </parent> <artifactId>commons</artifactId> <version>1.1-SNAPSHOT</version> <name>common</name> <description>common</description> <properties> <liquibase.version>4.21.1</liquibase.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> </dependency> <dependency> <groupId>org.mapstruct</groupId> <artifactId>mapstruct</artifactId> <version>1.5.3.Final</version> </dependency> <dependency> <groupId>org.liquibase</groupId> <artifactId>liquibase-core</artifactId> <version>${liquibase.version}</version> </dependency> <dependency> <groupId>com.networknt</groupId> <artifactId>openapi-parser</artifactId> <version>2.1.8</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>11</source> <target>11</target> <annotationProcessorPaths> <path> <groupId>org.mapstruct</groupId> <artifactId>mapstruct-processor</artifactId> <version>1.5.3.Final</version> </path> <path> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>${lombok.version}</version> </path> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok-mapstruct-binding</artifactId> <version>0.2.0</version> </dependency> </annotationProcessorPaths> <compilerArgs> <compilerArg> -Amapstruct.defaultComponentModel=spring </compilerArg> </compilerArgs> </configuration> </plugin> </plugins> </build> </project> 

Im tried all from this issue, but it not help me:

Why does IntelliJ give me "Package doesn't exist" error?

Its my dependency, and maven see it: dependency structure

Give thoughts in which direction to move. Thanks!

its my maven settings. Im tried user bundeled maven, and another version. ide settings

I need to run Maven Install, but I get the error that Maven doesn't see any of the Commons classes

SOLUTION: The solution to my problem was to remove the spring-boot-maven-plugin from the child pom

6
  • Did you try refreshing/rebuilding the Maven project in your IDE? Could be a caching issue? Are you experiencing this issue from the command line? If this is IntelliJ, make sure you open the Maven view and click the "refresh" icon on the panel. It should appear as a tab on the far-right of the window. Commented May 1, 2023 at 12:40
  • I tried to delete .m2, invalidate caches, reboot the maven project, rebuild the java project, etc. Commented May 1, 2023 at 12:51
  • Did you try clicking the synchronize button as suggested? Commented May 1, 2023 at 12:59
  • yes, im tried this a lot of time Commented May 1, 2023 at 13:06
  • Hi& Welcome! You have a (custom) parent pom (and "3 modules") ..have you tried from parent? ..which mvn install fails? Commented May 1, 2023 at 13:17

1 Answer 1

0

I tried moving packages from dto to another module, imported and it worked.

Sign up to request clarification or add additional context in comments.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.