Açıklaması şöyle
The Maven Resources Plugin is a Maven plugin that is used to copy project resources to the output directory. Resources are files that are not compiled into the project's bytecode, but are still needed by the project at runtime. For example, resources can include images, configuration files, and database scripts.The Maven Resources Plugin has two main goals:copy-resources: This goal copies the project's resources to the output directory.filter-resources: This goal filters the project's resources using a regular expression.
copy-resources Goal
Dosyaları kopyalar
directory Alanı
resources/resource/directory ile kaynak dizin belirtilir. outputDirectory ile hedef dizin belirtilirÖrnek
Bazı dosyaları jar'ın dışındaki bir yere kopyalamak için şöyle yaparız.
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>
target/static_content/csvs
</outputDirectory>
<resources>
<resource>
<directory>static_content/csvs</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Örnek
logback.xml dosyasını kopyalamak için şöyle yaparız
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-resources-plugin</artifactId><version>3.1.0</version><executions><execution><id>copy-resources</id><phase>process-classes</phase><goals><goal>copy-resources</goal></goals><configuration><outputDirectory>${targetDir}</outputDirectory><resources><resource><directory>{basedir}/src/main/resources</directory><includes><include>logback.xml</include></includes></resource></resources></configuration></execution></executions></plugin>
propertiesEncoding Alanı
Java 9'dan itibaren UTF-8 kullanılmalı.
Örnek
Şöyle yaparız
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<configuration>
...
<propertiesEncoding>ISO-8859-1</propertiesEncoding>
...
</configuration>
</plugin>
Hiç yorum yok:
Yorum Gönder