Giriş
Şöyle yaparız
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.8.1</version>
</plugin>
display-dependency-update seçeneği - Dependency İçindir
Kullanılan bağımlılıkların yeni sürümleri varsa onları gösterir
./mvnw versions:./mvnw versions:display-dependency-updates
This will display a list of dependencies for which newer versions have been found.
display-version-updates seçeneği - Plugin İçindirAçıklaması şöyle
Kullanılan eklentilerin yeni sürümleri varsa onları gösterir
./mvnw versions:./mvnw versions:display-version-updates
This will display a list of plugins for which newer versions have been found.
set seçeneği - Pom Dosyasında Sürüm Numarasını Günceller
Açıklaması şöyle
The Versions Maven plugin provides a goal, called the versions:set. This goal sets the current project’s version and based on that change propagates that change onto any child modules as necessary.
Örnek
Şöyle yaparız. Bu komut ile pom.xml güncellenir
mvn versions:set -DnewVersion=2.50.1-SNAPSHOT
Daha sonra şöyle yaparızmvn versions:commit
Örnek
Şöyle yaparız. Burada daha kolay kullanmak için 3 farklı profile tanımlanıyor.
1. patch profile ile sondaki sayı artırılıyor yani 1.2.X gibi
2. minor profile ile ortadaki sayı artırılıyor yani 1.X.0 gibi
3. major profile ile ilk sayı artırılıyor yani X.1.0 gibi
<profiles>
<!-- Patch bump Profile-->
<profile>
<id>bump-patch</id>
<activation>
<property>
<name>bumpPatch</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.8.1</version>
<executions>
<execution>
<goals>
<goal>set</goal>
</goals>
<phase>validate</phase>
<configuration>
<!--suppress UnresolvedMavenProperty -->
<newVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.nextIncrementalVersion}</newVersion>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- Minor bump Profile-->
<profile>
<id>bump-minor</id>
<activation>
<property>
<name>bumpMinor</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.8.1</version>
<executions>
<execution>
<goals>
<goal>set</goal>
</goals>
<phase>validate</phase>
<configuration>
<!--suppress UnresolvedMavenProperty -->
<newVersion>${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion}.0</newVersion>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- Major bump Profile -->
<profile>
<id>bump-major</id>
<activation>
<property>
<name>bumpMajor</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.8.1</version>
<executions>
<execution>
<goals>
<goal>set</goal>
</goals>
<phase>validate</phase>
<configuration>
<!--suppress UnresolvedMavenProperty -->
<newVersion>${parsedVersion.nextMajorVersion}.0.0</newVersion>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Kullanım ve çıktısı şöyle> mvn validate -DbumpPatch
Updating project ...
from version 0.0.1 to 0.0.2
> mvn validate -DbumpMinor
Updating project ...
from version 0.0.2 to 0.1.0
> mvn validate -DbumpMajor
Updating project ...
from version 0.1.0 to 1.0.0
Hiç yorum yok:
Yorum Gönder