directory Alanı
resource directory belirtilir.
Örnek Şöyle yaparız. Gerekirse resource directory içindeki dosya uzantıları da ayrı ayrı belirtilebilir.
<build>...<resources><resource><directory>src/main/java</directory><includes><include>**/*.xsl</include><include>**/*.xml</include><include>**/*.xsd</include><include>**/*.properties</include></includes></resource><resource><directory>src/main/resources</directory></resource><resource><directory>src/main/avro</directory></resource></resources></build>
exclude Alanı
Örnek
Şöyle yaparız
<resources><resource> <directory>[your directory]</directory> <excludes> <exclude>[non-resource file #1]</exclude> <exclude>[non-resource file #2]</exclude> <exclude>[non-resource file #3]</exclude> <exclude>[non-resource file #n]</exclude> </excludes> </resource> ... </resources>
Resource Filtering
Açıklaması şöyle
The ${project.version} and ${project.name} are examples of placeholders that Maven provides out of the box. You can use these placeholders to refer to project-related information such as the project version and name. You can also define your custom placeholders in the <properties> section of the pom.xml file and use them in your resource files.By leveraging resource filtering, you can generate customized resource files for different environments or configurations without manually modifying the files each time. Maven will handle the filtering based on the configuration in the pom.xml file.Note: Remember to use proper filtering directives (@, @{}, or ${}) based on the type of placeholder you are using and the file format you're working with (e.g., properties, XML, JSON, etc.).
mvn package komutu çalıştırılır. Projenin paketleme tipine göre dosya target/classes veya target/classes/META-INF dizinine kopyalanır
Örnek
src/main/resources/config.properties şöyle olsun
# config.properties app.version=${project.version} app.name=${project.name}
Şöyle yaparız
<build> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> </resources> </build>
Hiç yorum yok:
Yorum Gönder