Eu configurei um multimodelo simples em um projeto de comunidade usando java, mas nenhum dos módulos é reconhecido ou compatível, não tenho ideia de por que usar no Windows 10:
IntelliJ IDEA 2022.3.2 (Community Edition)
Build #IC-223.8617.56, built on January 26, 2023
Runtime version: 17.0.5+1-b653.25 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Non-Bundled Plugins:
Batch Scripts Support (1.0.13)
CMD Support (1.0.5)
org.rust.lang (0.4.194.5382-223)
sandipchitale.springinitializr (1.0.17)
Docker (223.8617.59)
dev.flikas.idea.spring.boot.assistant.plugin (222.17.3)
Kotlin: 223-1.8.0-release-345-IJ8617.56
É assim que eles configuram no IDE:
stock-ui pom
<?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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.stockui</groupId>
<artifactId>stock-ui</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>stockcui</name>
<description>ui project for Spring Boot</description>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</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-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
pom do cliente de estoque:
<?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.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.stockclient</groupId>
<artifactId>stockclient</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>stockclient</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</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-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
se eu construir a partir da linha de comando, a construção terá sucesso, mas nenhuma classe será criada X
XXXXX MINGW64 /c/dev/my/java/spring_applications/ReactiveSpringBootREST Service2/stockclient/stock-ui
$ mvn clean install -U
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< com.stockui:stock-ui >------------------------
[INFO] Building stockcui 1.0-SNAPSHOT
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.3.2:clean (default-clean) @ stock-ui ---
[INFO]
[INFO] --- spring-boot-maven-plugin:3.2.2:repackage (repackage) @ stock-ui ---
[INFO]
[INFO] --- maven-install-plugin:3.1.1:install (default-install) @ stock-ui ---
[INFO] Installing C:\dev\my\java\spring_applications\ReactiveSpringBootREST Service2\stockclient\stock-ui\pom.xml to C:\Users\xxxxx\.m2\com\stockui\stock-ui\1.0-SNAPSHOT\stock-ui-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.144 s
[INFO] Finished at: 2024-02-04T12:48:52+02:00
[INFO] ------------------------------------------------------------------------
Esta é a única classe em stock-ui
package com.stockui.stockui;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class StockUIapplication {
public static void main(String[] args){
SpringApplication.run(StockUIapplication.class, args);
}
}
Projetos multimódulos normalmente são configurados com um pom raiz.
Dê uma olhada neste exemplo:
O pom raiz seria declarado da seguinte forma:
A adição de módulos pode ser feita através de:
Visite Estrutura do Projeto para ver seus módulos:
Compile todos os módulos: