I'm getting a compilation error when building a java project with instances of classes in client-a
being using in controller
:
/path/to/file/project/controller/Config.java [50,1] package com.stuff.clienta does not exist
cannot find symbol ClientAClass
So I recently added two new modules to a multi-module java project using Maven. module-a
& client-a
. Such that module-a
is dependent on client-a
. This project also has existing modules, and there is one "master" module that initializes all the beans in the project called controller
, thereby, controller
is dependent on client-a
.
When running mvn install
I get the error only on references to files in client-a
in controller
. module-b
builds fine.
I've gone through all the answers here (Maven, package does not exist) and wasn't able to get past this issue.
Additionally, in the controller
pom, I added the dependency as such
<dependency>
<groupId>com.stuff.clienta</groupId>
<artifactId>client-a</artifactId>
</dependency>
the exact same way as it is in module-a
and I confirmed maven reactor is working because with this dependency, client-a
gets built first, without, client-a
gets built at the end.
Additionally, the parent pom has client-a
as a dependency in the dependencyManagement section:
<dependency>
<groupId>com.stuff.clienta</groupId>
<artifactId>client-a</artifactId>
<version>${project.version}</version>
</dependency>
Any guidance would be helpful. At this point I don't really think it's related to the pom, but something in the build. I've tried deleting the target
folders and the .m2
folders (for just this project) then rebuilding but I get the same problem...
EDIT: parent pom info
<?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>
<packaging>pom</packaging>
<modules>
<module>controller</module>
<module>module-a</module>
<module>client-a</module>
</modules>
<groupId>com.stuff</groupId>
<artifactId>root</artifactId>
<version>1.0</version>
<name>root</name>
<description>Stuff</description>
<properties>
... versions
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.stuff</groupId>
<artifactId>controller</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.stuff</groupId>
<artifactId>module-a</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.stuff</groupId>
<artifactId>client-a</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<pluginManagement>
<plugins>
... springboot, mojo, checkstyle
</plugins>
</pluginManagement>
<plugins>
... jacoco, checkstyle, maven
</plugins>
<extensions>
...
</extensions>
</build>
</project>