Does Maven 3.5.2 supports Java11 builds - jenkins

In Jenkins, currently there is only JDK8 and maven 3.5.2 installed. I downloaded JDK11 to it. I ran a pipeline project to build a springboot Java11 project and it ran fine using maven 3.5.2. There is no reference to any maven source or target versions in the pom of the project. Currently I don't see any issues with JDK11 with maven 3.5.2 due to simplicity of the project. Any idea if it might cause issues with complex projects? Is it good to update Maven version in Jenkins and the spring boot projects?

Related

Jenkins: Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8

I am facing issue in jenkins job(jenkins running docker) Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
I have checked java version in docker it is openjdk version "11.0.12" 2021-07-20
we can solve this in Android Studio but how can we solve while running gradle build in jenkins.
Below is the error I am getting
Build file '/var/jenkins_home/workspace/CICDDemo_master/app/build.gradle' line: 2
What went wrong:
An exception occurred applying plugin request [id: 'com.android.application']
Failed to apply plugin 'com.android.internal.application'.
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing org.gradle.java.home in gradle.properties.
In your Jenkins project choose the "configure" tab on the left side, then scroll down to "Properties Content" and write there:
JAVA_HOME=C:\Program Files\Java\jdk-11.0.12
GRADLE_USER_HOME=C:\

Packaging nuget package on VSTS 'Newtonsoft.Json' already has a dependency defined for 'NETStandard.Library'

Packaging a build use Nuget Packager in VSTS and i get the error:
[error]'Newtonsoft.Json' already has a dependency defined for 'NETStandard.Library'.
Most of the hints that solves this involves updating nuget, but since I am building on Team Services I can't really do this.
It seems that the nuget used by nuget packager is not the latest. After testing locally with latest nuget.exe everything worked so I added a new powershell release step. This solution is appropriate for VSTS, for TFS where you have access to the server I recommend upgrading nuget.exe on the server itself:
This script downloads nuget.exe into the artifacts directory (and outputs the path to the nuget.exe so you can see where it is put.).
I then altered the Nuget Packager build step to use the freshly downloaded nuget.exe.
Had the same issue today.
Using your own build agent
If you are using your own build agents (rather than the hosted agent) you can manually update the version of NuGet to the latest version. In my case, this has resolved my problems.
e.g. C:\agent\externals\nuget\nuget.exe
Using the hosted agent
It's a bit messy but you could just upload the latest nuget.exe into the repo and set the NuGet Packager to use this.
To anyone getting this in 2018, Microsoft have created a new version of the NuGet task that fixes this issue. No need for powershell install steps.
Change the NuGet task version in your build step version to 2.*
This caused some breaking changes for me, that I resolved with the following advanced settings
Nuget Restore
Nuget Pack
Nuget push

After import of an existing project, the gradle version is less then when creating a Gradle project

When I create a new Gradle project, the Gradle version is 3.3. But when I import an existing Gradle project, the Gradle version is 2.4.11. How are the version determined, especially the last one, because as far as I can see, there is no Gradle version information in the existing Gradle project.
I don't know am I understand your issue correctly or not. But as I understood:
The version of gradle is determined in your build.gradle file.
There is a line there like below:
classpath 'com.android.tools.build:gradle: 2.2.2'
which 2.2.2 is the version.
the highest stable version till now is 2.2.3 (which it is not suitable for me) .
Note that versions above 2.2 need jdk 8 (not work with jdk 7)
I found out that you have to look at the file gradle/wrapper/gradle-wrapper.properties. The last line of this file gives the Gradle version:
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip
Before importing an existing Gradle project, maybe you want to edit this line.

Eclipse: An internal error occurred during: “Update Hierarchy”

While trying to run the Google cloud dataflow Wordcount example in eclipse referenced here https://cloud.google.com/dataflow/docs/quickstarts/quickstart-java-eclipse
I am getting the following error:
An internal error occurred during: "Update Hierarchy".
Tried to create a TypeHierarchyPipelineOptionsHierarchy for a Java Project 'my project name' where no PipelineOptions type exists
This issue was also faced by somebody else as per the following stackoverflow link:
Eclipse: An internal error occurred during: "Update Hierarchy"
I tried the solution above, the project compiles but it does not run even after Force Update of Snapshots/Releases as explained above.
Based on my research of the problem it looks like google-cloud-dataflow-java-sdk-all-2.0.0-beta1.jar does not have the PipelineRunner class, which is causing the error. The 1.9.0 version of the same jar had those classes.
I cannot use 1.9.0 version of the jar directly because it causes other compilation errors e.g. package change to 'org.apache.beam' instead of 'com.google.cloud.dataflow'
Indeed, there's an issue in the older versions of the Google Cloud Dataflow plugin for Eclipse -- older versions are not forward-compatible with Dataflow SDKs 2.x series, but the project generation may still automatically create a project using the newest 2.x SDK.
To solve the problem, please upgrade to the newest version of the plugin.
Projects generated with versions 1.1.2 of the Dataflow Plugin for Eclipse and earlier will generate projects using the most recent archetype. With the release of Dataflow 2.0.0-beta1, the generated project will use the Apache Beam SDK as an underlying dependency. Modifying the project version to 1.9.0 or earlier will not modify the generated code, which causes the compilation failures you're experiencing.
Version 1.1.3 of the plugin will ensure that any generated project remains within the Dataflow namespace. Future versions will also work forwards-compatibly with Apache Beam. Version 1.1.3 should be available - in Eclipse, go to Help -> Check for Updates (possibly running Perform Setup Tasks to clear the cached current version) should make the updated plugin available.
We have published version 1.1.3 of the Dataflow Plugin for Eclipse; the quickstart example should now function. The project you've generated will not work until a future release of the Dataflow Plugin for Eclipse. Updating the plugin and re-running the quickstart should succeed.

Jenkins maven builds fail with 0ms

We recently migrated jenkins to the LTS version 1.532.2. Ever since, we have been experiencing problems with maven builds failing frequently and claims the entire build took only 0ms as seen in the build trend.
The maven project plugin itself wasn't upgraded as he latest version had a different issue. The current maven project plugin in use is 2.0
Has anyone experienced this behavior?

Resources