kiwix / java-libkiwix

Libkiwix binding for Java & Kotlin
https://central.sonatype.com/artifact/org.kiwix/libkiwix
GNU General Public License v3.0
3 stars 4 forks source link

Upload a "dev" version to Maven Central #49

Open kelson42 opened 1 year ago

kelson42 commented 1 year ago

Developers using java-libkiwix can only use the official releases of the library... or compile it themselves... which is a bitcumbersome.

This is is in particular true for kiwix-android devs. .

Would really ease the integration work around java-libkiwix to publish for each commit, a "dev" version on Maven Central.

MohitMaliFtechiz commented 1 year ago

We can publish the java-libkiwix for each commit on maven central, but the artifact will not be available for downloading and testing until it is officially released . Users can download the .aar or .pom file from Maven for the released versions, but there is no option to download the staging artifact.(which have not been officially released yet).

kelson42 commented 1 year ago

@MohitMaliFtechiz Why SNAPSHOTS don't do the job? https://maven.apache.org/guides/getting-started/index.html#what-is-a-snapshot-version

MohitMaliFtechiz commented 1 year ago

@kelson42, SNAPSHOTS are different they are mainly use for development environment and they will upload to the other directory https://s01.oss.sonatype.org/content/repositories/snapshots/. But yes SNAPSHOTS will do the job since they are immediately available for testing after uploading so developer do not need to wait for a while like release artifact, but there is some things to be notice.

If we wish to publish a snapshot on every commit, it is crucial to increment the version number appropriately. For example, if we initially published version 1.0.0-SNAPSHOT, any subsequent updated snapshot with new code changes should have an incremented version number, such as 1.0.1-SNAPSHOT. Attempting to publish the updated code with the same version 1.0.0-SNAPSHOT would lead to an error, as Maven recognizes that the version already exists in the repository.

In my opinion, uploading a snapshot for every single commit may not be ideal. In some cases, commits may contain small and necessary changes that may not warrant a new snapshot version. Instead, a more practical approach could be to upload the snapshot while merging the pull request.

So to implement this, we need to refactor our CI and code as snapshot will publish to the other URL.

kelson42 commented 1 year ago

If we wish to publish a snapshot on every commit, it is crucial to increment the version number appropriately. For example, if we initially published version 1.0.0-SNAPSHOT, any subsequent updated snapshot with new code changes should have an incremented version number, such as 1.0.1-SNAPSHOT. Attempting to publish the updated code with the same version 1.0.0-SNAPSHOT would lead to an error, as Maven recognizes that the version already exists in the repository.

I think you misunderstand how it works or your explanation is confusing. Read https://www.baeldung.com/maven-snapshot-release-repository

There is no additional work of difficulty to publish automatically each new time we merge on main to the SNAPSHOT repo.

MohitMaliFtechiz commented 1 year ago

@kelson42, Thanks now I have understood correctly, we can use the snapshots for the development code.