The dependency is not added to the project

59 Views Asked by At

enter image description here

It is not possible to use the project in another project as a dependency. mvn clean install in the project that I want to use as a dependency (photo of a successful build) in another project, I wrote in pom

<dependency>
<<group ID>com.consumer</groupId>
<<artifact ID>socket consumer</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>

enter image description here enter image description here

Updating Maven Dependencies:

Make sure that your project includes the correct dependencies in the file pom.xml . In IntelliJ IDEA: Select "View" -> "Windows Tool" -> "Maven", and in the window that opens, Reload the Project or update the dependencies (Reimport).


In IntelliJ IDEA: Select "File" -> "Invalidate Caches / Restart..." and select "Invalidate and Restart". After restarting IntelliJ IDEA, the project will be reindexed.


Rebuilding the project:

Rebuild the project via Maven (mvn clean install) on the command line.

@RestController
@RequestMapping("/api/producer")
public class ProducerController {

    @Autowired
    private SimpMessagingTemplate messagingTemplate;
    private UserAuditRepository userAuditRepository;

    private static final Logger logger = LoggerFactory.getLogger(ProducerController.class);


    @Autowired
    public ProducerController(UserAuditRepository userAuditRepository) {
        this.userAuditRepository = userAuditRepository;
    }

    @GetMapping("/send-message")
    public ResponseEntity<String> sendMessageToUser() {
        logger.info("Sending message to all users");

                UserAudit newUser = new UserAudit();

        MessageDto messageDto = new MessageDto(true, "gold", 123, "Hello World", newUser.getUserId());

        messagingTemplate.convertAndSend("/topic/messages", messageDto);

        return ResponseEntity.ok("Message sent to all users");
    }
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.2.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.consumer</groupId>
    <artifactId>consumersocket</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>consumersocket</name>
    <description>consumersocket</description>
    <properties>
        <java.version>17</java.version>
        <maven.compiler.source>20</maven.compiler.source>
        <maven.compiler.target>20</maven.compiler.target>
    </properties>

Even when I press Alt Enter, nothing is displayed

0

There are 0 best solutions below