12 Aralık 2021 Pazar

remote-resources plugin - Modüldeki Resource Dosyalarını Paylaşmak İçin Kullanılabilir

Giriş
Bu plugin'de iki tane goal var
1. bundle
2. process

bundle
Modüldeki src/main/resources altındaki Resource Dosyalarını Paylaşmak İçin Kullanılabilir. generate-resources safhasında belirtilen dosyaları bundle haline getirir.
Örnek
Resource Bundle olan projede şöyle yaparız
<plugin>      
  <artifactid>maven-remote-resources-plugin</artifactid>
  <version>1.1</version>
  <executions>
    <execution>
      <goals>
        <goal>bundle</goal>
      </goals>
      <configuration>
        <includes>
          <include>**/*.xml</include>
        </includes>
      </configuration>
    </execution>
  </executions>
</plugin>
Açıklaması şöyle
You now should see the following message in your mvn output while running mvn clean install.
[remote-resources:bundle {execution: default}]

This produces a /target/classes/META-INF/maven/remote-resources.xml file which contains references to the resource files. For example,
<remoteresources>
    <remoteresource>test.xml</remoteresource>
</remoteresources>
Resource Bundle dosyasını kullanmak isteyen modülde şöyle yaparız
<plugin>      
  <artifactid>maven-remote-resources-plugin</artifactid>
  <version>1.1</version>
  <executions>
    <execution>
      <goals>
        <goal>process</goal>
      </goals>
      <configuration>
        <resourcebundles>
          <resourcebundle>com.lorenzen:lorenzen-core:${pom.version}</resourcebundle>
        </resourcebundles>
      </configuration>
    </execution>
  </executions>
</plugin>
Açıklaması şöyle
You now should see the following message in your mvn output while running mvn clean install.

[remote-resources:process {execution: default}]

You should now be able to look into your second modules /target/classes directory and see test.xml.
Örnek
Resource Bundle olan projede şöyle yaparız
<plugin>
  <artifactId>maven-remote-resources-plugin</artifactId>
  <version>1.7.0</version>
  <executions>
    <execution>
      <goals>
        <goal>bundle</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <includes>
      <include>**/*.ddl</include>
      <include>**/*.sql</include>
    </includes>
  </configuration>
</plugin>
Resource Bundle dosyasını kullanmak isteyen modülde şöyle yaparız
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-remote-resources-plugin</artifactId>
  <version>1.7.0</version>
  <configuration>
    <resourceBundles>
      <resourceBundle>org.test:shared-resources:${project.version}</resourceBundle>
    </resourceBundles>
  </configuration>
  <executions>
    <execution>
      <goals>
        <goal>process</goal>
      </goals>
    </execution>
  </executions>
</plugin>























Hiç yorum yok:

Yorum Gönder

Local Snapshot Kullanmak

Örnek Şöyle yaparız <repository> <id>snapshot-repository</id> <name>Maven2 Snapshot Repository</name> &l...