Where does axion-release plugin currentVersion come from? - gradle

I am using gradle, I added the plugin
plugins {
id 'pl.allegro.tech.build.axion-release' version '1.14.0'
}
now when I am running
./gradlew currentVersion
I am getting
Project version: 0.1.0-SNAPSHOT
I tried adding a gradle.properties that contains
version=0.0.1-SNAPSHOT
But when running
./gradlew currentVersion
it still returns 0.1.0-SNAPSHOT
I'd like to know where that's coming from and if it's possible to use the value from gradle.properties, or what's the best way to use the version with the plugin.
Thanks.

If it still return 0.1.0-SNAPSHOT, that's by design. As stated by Adam Dubiel from Allegro:
... by design axion-release does not include version number in build.gradle. Philosophy of axion-relese is that version is not declared in files, but is a product of source code version tracked by SCM - git.
Then your can have a look at the documentation or at Allegro tech blog:
The flow of axion-release-plugin is simple. Each time you start a build it looks for the version tag closest to current commit and extracts the version number from it. If you happen to be on a tagged commit, you operate on release version. If not, patch version is increased and SNAPSHOT suffix is appended.
Here is an example of the flow:
$ git tag
project-1.0.0
$ ./gradlew currentVersion
1.0.0
$ git add . && git commit -m "I've just changed something"
$ ./gradlew currentVersion
1.0.1-SNAPSHOT
$ ./gradlew release
$ git tag
project-1.0.0 project-1.0.1
$ ./gradlew cV # gradle magic - currentVersion
1.0.1
I hope this helps, despite the late reply

Related

how to change gradle version in nativescript

I'm confused as how to change a specific configuration somewhere to determine the version of my gradle, in a nativescript project.
My workspace is created with nx and when I try to run the app with npx nx run test:android I get this error message:
Could not compile settings file '<somepath>\start\learn\apps\nativescript-test\platforms\android\settings.gradle'.
> startup failed:
General error during conversion: Unsupported class file major version 62
Based on my research if I need to resolve this issue I need to either update my gradle version or downgrade my JDK version. The solution I'm searching for is to how to specify my gradle version.
Thanks in advance.
based on my understanding version of gradle is defined by #nativescript/android package (read its README.md), so if updating the #nativescript/android doesn't help do the next steps
1- install jdk 18 -> because its the first version that supports major version 62
2- add JAVA_HOME to env vars
3- in platform/gradle.properties add org.gradle.java.home=C:\\Program Files\\Java\\jdk-18.0.1 (because in my case gradle didn't read form JAVA_HOME)
4- change platform/gradle-wrapper gradle version to 7.4.2
5- in platform/build.gradle do this: replace whatever version of plugin to classpath 'com.android.tools.build:gradle:7.2.0'

How to resolve compileJava errors during heroku deployment?

I worked as follows to deploy Intellij Spring Boot using gradle on heroku. I proceeded from the directory containing the source files.
> git init
> git add .
> git commit -m "first commit"
> heroku create
> git push heroku master
However, the following error occurred during the push process.
What went wrong: Execution failed for task ':compileJava'.
invalid source release: 11
After the problem occurred, a file called system.properties was also created in the source file and the following input was also entered.
java.runtime.version=11
But it is still unresolved. How do I solve this problem?
First you have to ensure your local development and your deployed instance are using the same version.
You specified a version with system.properties with content java.runtime.version=11 but haven't provided an image of the updated log. The log still says you are installing JDK 1.8.
Furthermore you should specify a Java version that is currently being supported. You can find the versions here: https://devcenter.heroku.com/articles/java-support#supported-java-versions
Java 7 - 1.7.0_302
Java 8 - 1.8.0_292
Java 11 - 11.0.11
Java 13 - 13.0.7
Java 15 - 15.0.3
Java 16 - 16.0.1
I've just face this problem following a course. Solve it by change the sourceCompatibility='17'(on my file) to '1.8' on my built.gradle file change sourceCompatibility='1.8' on build.gradle file
and change the Gradle JMV on setting and JKD on project structure to 1.8.
enter image description here
duno if the last change anything, but worked for me.

Fail to build under circle-ci / gradle / lombok -- decorated class LombokPlugin / FindBugExtension

I have some code that built last week on both my desktop and Circle-CI, but today it built only on my desktop but not on Circle-CI. The error message was
* What went wrong:
An exception occurred applying plugin request [id: 'io.freefair.lombok', version: '4.1.2']
> Failed to apply plugin [id 'io.freefair.lombok']
> Could not create plugin of type 'LombokPlugin'.
> Could not generate a decorated class for class io.freefair.gradle.plugins.lombok.LombokPlugin.
> org/gradle/api/plugins/quality/FindBugsExtension
Does this message ring a bell with someone? (By the way, I also tried upgrading io.freefair.lombok to 4.1.3 but that didn't help)
Thanks!
I found a solution -- switch to use gradle wrapper (instead of the gradle deployed on CircleCI), and also make the wrapper executable.
To do the former, edit the file config.yml used by CircleCI
To do the latter, use the following git command:
$ git update-index --chmod=+x ./gradlew
By the way, in the error message on CircleCI, it mentioned Gradle 7.0 that got me thinking that may be there was a recent version upgrade on the platform, and hence the idea of the fix.

Processing: apply core patch and compile

I want to apply this patch
https://github.com/processing/processing/pull/5881
into my own processing core for use in my PDE. How do I go about ?
i can take the source here
https://github.com/processing/processing
apply the patch
compile that (eg using javac) to get a core.jar
But in the App, there are two core.jars :
Processing.app/Contents/Java/core/library/core.jar
and
Processing.app/Contents/Java/core.jar
which one is what ?
Did this:
read this howto
https://github.com/processing/processing/blob/master/build/howto.txt
clone this repo
https://github.com/processing/processing
downloaded the correct version java
get an account at oracle.com
and download java (in my case 8u202) here
https://www.oracle.com/java/technologies/javase-java-archive-javase8-downloads.html
and install that.
build the app with ant
Go into your cloned repo and
cd build
ant run
This builds a processing PDE in the build/ directory of your repo
and opens it. It works.
apply the patch and build it again
git checkout -b pull/5881
git pull origin pull/5881/head
ant run
That creates a new branch, pulls the patch I wanted to apply, applies that, builds the PDE again and runs it.
And the patch fixed my problem :-)

Update gradle version if necessary on autodeployment

I updated gradle locally by changing the version in my build.gradle file here:
wrapper {
gradleVersion = '5.6.1'
}
Next I was not able to build directly due to errors, but my IDE noticed that the version of gradle has changed and offered to install it through a popup. After that everything worked.
When I pushed my changes to my autodeployment tool it currently builds the project by executing:
call gradlew clean war
But I'm getting the same errors and this time there's no smart IDE to come to the rescue :D Therefore my question:
How can I make sure my gradle always updates to the version that is defined in build.gradle before trying to build?
The version of Gradle that is used by the wrapper script is the one defined in the file gradle/wrapper/gradle-wrapper.properties.
When you want to update Gradle, you could go manually changing that file, but this won't update the actual wrapper script and jar file. So it is a better practice to run ./gradlew wrapper, which will update gradle-wrapper.properties and, if needed, the other support files as well.
To tell the wrapper task which version you want to use upgrade to, you can either use a command line parameter, or do what you are doing and keep the version in the build.gradle file (this is always what I do as well).
I usually run the wrapper task twice: first to update the version and second to both download the new version and then regenerate the scripts from this new version.
Remember to commit all files changed by the wrapper task, which could be gradlew, gradlew.bat and the two files in the gradle/wrapper folder.

Resources