19 Eylül 2023 Salı

wagon plugin

Örnek
Şöyle yaparız
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>wagon-maven-plugin</artifactId>
  <version>2.0.2</version>
  <executions>
    <execution>
      <id>download-file-1</id>
      <phase>process-resources</phase>
      <goals>
        <goal>download-single</goal>
       </goals>
       <configuration>
         <url>https:/.../couchbase-kafka-connect-couchbase-4.1.11.zip</url>
         <toDir>${project.build.directory}/classes</toDir>
         </configuration>
         </execution>
       </executions>
</plugin>
Çalıştırmak için şöyle yaparız
mvn process-resources

17 Eylül 2023 Pazar

download plugin

Giriş
3 tane goal var
artifact
help
wget

wget Goal
Belirtilen dosyası indirir. Sadece <outputDirectory> ve <uri> bilgileri zorunlu. Çalıştırmak için şöyle yaparız
mvn download:wget
Eğer birden fazla wget varsa veya şöyle yaparız
mvn process-resources
Eğer logları görmek istersek şöyle yaparız
mvn download:wget -X
<cacheDirectory> Tag
İndirilen dosya <cacheDirectory> ile belirtilen yerde ön bellekte saklanır. Bu dizinin varsayılan yolu ${local-repo}/.cache/maven-download-plugin olarak. Ben kullanırken D:\Users\user\.m2\.cache\download-maven-plugin dizini altında önbellekte saklanan dosyaları gördüm

<retries> Tag
Varsayılan değer 2. Yani 2 defa indirme işlemini deniyor.

Örnek - Ortak Configuration
Şöyle yaparız. 1.7.2 bozuk
<plugin>
  <groupId>com.googlecode.maven-download-plugin</groupId>
  <artifactId>download-maven-plugin</artifactId>
  <version>1.6.8</version>
  <executions>
    <execution>
      <id>download-zip-file</id>
      <phase>process-resources</phase>
      <goals>
        <goal>wget</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <url>https://.../confluentinc-kafka-connect-datagen-0.6.0.zip</url>
    <unpack>false</unpack>
    <outputDirectory>${project.build.directory}/classes</outputDirectory>
    </configuration>
  </plugin>
</plugins>
process-resources aramasında wget ile dosya ${project.build.directory}/classes dizinine indirilir. Bu dizin aslında target/classes dizinine denk gelir.

Örnek - Birden Fazla Dosya İndirme
Şöyle yaparız
<plugin>
  <groupId>com.googlecode.maven-download-plugin</groupId>
  <artifactId>download-maven-plugin</artifactId>
  <version>1.6.8</version>
  <executions>
    <execution>
      <id>download-zip-file1</id>
      <goals>
        <goal>wget</goal>
      </goals>
      <configuration>
        <url>https://.../couchbase-kafka-connect-couchbase-4.1.11.zip</url>
        <unpack>false</unpack>
        <outputDirectory>${project.build.directory}/classes</outputDirectory>
      </configuration>
    </execution>
    <execution>
      <id>download-zip-file2</id>
      <goals>
        <goal>wget</goal>
      </goals>
      <configuration>
        <url>https://.../neo4j-kafka-connect-neo4j-2.0.1.zip</url>
        <unpack>false</unpack>
        <outputDirectory>${project.build.directory}/classes</outputDirectory>
      </configuration>
    </execution>
  </executions>
</plugin>
wget  process-resources Safhasında Çalışır
mvn test ile çalıştırılan safhalar şöyle. Yani wget aslında test sahasından önce çalışıyor. Eğer bu uygun değilse başka bir safhayı yazmak gerekir.
validate                         validate the project is correct and all necessary information is available.
initialize                         initialize build state, e.g. set properties or create directories.
generate-sources                 generate any source code for inclusion in compilation.
process-sources         process the source code, for example to filter any values.
generate-resources         generate resources for inclusion in the package.
process-resources               copy and process the resources into the destination directory, ready for packaging.
compile                 compile the source code of the project.
process-classes         post-process the generated files from compilation, for example to do bytecode enhancement on Java classes.
generate-test-sources         generate any test source code for inclusion in compilation.
process-test-sources         process the test source code, for example to filter any values.
generate-test-resources create resources for testing.
process-test-resources copy and process the resources into the test destination directory.
test-compile                 compile the test source code into the test destination directory
process-test-classes         post-process the generated files from test compilation, for example to do bytecode enhancement on Java classes.
test




12 Eylül 2023 Salı

Predefined Properties

project
Açıklaması şöyle
${project.build.directory} 
results in the path to your "target" directory ${project.build.outputDirectory} results in the path to your "target/classes" directory

${project.name} 
refers to the name of the project

${project.version} 
refers to the version of the project

${project.groupId} 
refers to the groupId of the project

${project.build.finalName} 
refers to the final name of the file created when the built project is packaged

Local Snapshot Kullanmak

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