Created
September 25, 2022 16:37
-
-
Save ylmazmehmet60/4c046ce3c2989aadcf29b81f65eab79e to your computer and use it in GitHub Desktop.
pom structure of multi module project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
multi module proje oluştururken pom'lar arası bağlantı kurmalıyız |
main brachdaki pom.xml'i konfigüre etmek için
<?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>
<groupId>org.example</groupId>
<artifactId>course</artifactId>
<version>1.0-SNAPSHOT</version>
<modules>
<module>core</module>
</modules>
<packaging>pom</packaging>
<properties>
<logback.version>1.3.0-alpha4</logback.version>
<slf4j.version>1.8.0-beta1</slf4j.version>
<spring.version>5.0.5.RELEASE</spring.version>
<java.version>1.8</java.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>
burada module kısmındaki core
modul olarak eklediğimiz proje ismini temsil ediyor
<modules>
<module>core</module>
</modules>
paketleme yapmak için gerekli
<packaging>pom</packaging>
bu kısımda versiyon tanımlaması yaparak modul pom.xml dosyalarındaki versiyonu rahatça belirliyoruz
<properties>
<logback.version>1.3.0-alpha4</logback.version>
<slf4j.version>1.8.0-beta1</slf4j.version>
<spring.version>5.0.5.RELEASE</spring.version>
<java.version>1.8</java.version>
</properties>
core modulu pom.xml dosyasında versiyon belirtmeden o modul için gerekli kütüphaneleri kullanabiliyoruz
<?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">
<parent>
<artifactId>course</artifactId>
<groupId>org.example</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>core</artifactId>
<dependencies>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
</dependencies>
</project>
degişikliklerin uygunabilmesi için
pom.xml doyaları için sağ tık > maven > reload project
yapıyoruz
ve maven konsolundan mvn clean install
komutunu uyguluyoruz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
boş bir maven projesi oluşturuyoruz, içindeki mevcut java kısmını siliyoruz
daha sonra modul olarak ekleme için File > New > Modulo olarak ekliyoruz
klasör yapısı şu sekilde görünecek