JHipster - Java build not compatible with the base image - jib - jhipster

I run a Docker image build command of a JHispter app
./mvnw package -Pprod verify jib:build
that yields an error:
Your project is using Java 17 but the base image is for Java 11, perhaps you should configure a Java 17-compatible base image using the '<from><image>' parameter, or set maven-compiler-plugin's '<target>' or '<release>' version to 11 or below in your build configuration
I find a solution for Gradle. How to do the same fix for Maven?

You can specify the image used using the property <jib-maven-plugin.image>eclipse-temurin:17-jre-focal</jib-maven-plugin.image> on the pom.xml, it should be defined as
<from>
<image>${jib-maven-plugin.image}</image>
<platforms>
<platform>
<architecture>${jib-maven-plugin.architecture}</architecture>
<os>linux</os>
</platform>
</platforms>
</from>
In the jib-maven-plugin build definition, on the pom.xml as well.

Related

Equivalent of Google's JIB for Node.JS?

Is there one equivalent of Google's JIB or BuildPacks for Node.JS ?
It is my understanding that JIB allows to build OCI container images from within the project's build tool like Gradle or Maven, as a developer we only have to include a plugin into the build and are able to package up the application into a container and having JIB implement all the best practices of packing up a Java application into container with no questions asked.
I have search around but have not found something equivalent for the Node.JS ecosystem.
It should be possible just into a node developer time dependency and it take care on packaging up my javascript/typescript Express.js for example app into a docker container or OCI image.
Thank you, Oscar
For posterity, I'll list some NodeJS-native Docker image creation packages (these usually can be added to your project's package.json). In no particular order:
nodejs-container-image-builder - container registry client and image builder with no dependency on docker (by Google)
Dockta - A Docker image builder for researchers
EZDocker - build docker images in Javascript
I did try Dockta and it has SUPER simple one-liner docker file/image build (either a simple package.json script or direct command line), it works nicely.
Yes, Heroku has a Node.js Buildpack. You can run it using the Pack CLI like this:
$ pack build myimage --builder heroku/buildpacks:18 --buildpack heroku/nodejs
If you are using GitLab, you can simply use Kaniko as well.

How to create a build pipeline for multi-module maven in Azure Devops

I have a multi-module maven project in azure repo:
Parent
----App
--POM.xml
----Core
--POM.xml
----API
--POM.xml
----ParentPOM.xml
When I tried to build App project in Azure, I am getting the following error: [ERROR] Failed to execute goal on the project: Could not resolve dependencies for project com.core:jar:1.0: Could not find artifact com.core:jar:1.0 in central (https://repo.maven.apache.org/maven2).
So I tried to create multiple tasks in the same azure build to package for each module (App, Core, API), which also gives the same result. Could someone please help me on how to build the multi-module project and get the App jar file.
The way I've done it:
with this command: install -pl (module name) -am
where the module name should be one of the submodules. If you want to build all of them then only go with install
I have found the solution for the multi-module maven dependency issue, First We need to build the parent pom.xml, then build the submodules as per hierarchical order. In between each module, add a task to copy and move the jar files to the staging directory. Here shared the image of my build steps. Please take a look and comment on any questions.
Please look into the DevOps configuration for reference

Running gauge tests from jar file

I am new to gauge testing tool .I have a maven project that consists of specs and step implementations. Mvn package phase does generate a jar file with all the required classes. However I cant figure out how i can run the gauge specs using a Main class in java, such that i can just run the jar file to run the tests. Is this possible?
Unfortunately no, Gauge binary must be installed and available to execute the specs.
As the Gauge binary is not written in java it cannot be bundled in a jar file and invoked from a Main class.
If you'd like to automatically download and use Gauge in a CI/CD environment, try something like https://github.com/maven-download-plugin/maven-download-plugin to download gauge into a convenient location as part of your mvn build itself.
More info about this here
There is a way to do this. You have to package maven and gauge inside the project directory and include them in the jar. In the main method, unzip all files, then run a shell script to export maven and gauge in the project directory to $PATH, then execute mvn gauge:execute as usual. It's a bit of a hack as it extracts everything to the directory in which the jar is located, but it works on RHEL 7 and I haven't managed to find a cleaner method.

Building war file with -Pprod does not set active spring profile to prod when running war file

I am attempting to build a jhipster application for production with the following command:
./mvnw -Pprod package
According to the documentation here https://jhipster.github.io/profiles/ the war file should automatically run with the active spring profile "prod" when it is kicked off. However, I'm finding that is runs with the defaults of swagger,dev.
Am I missing something here? If I set --spring.profiles.active=prod when running the build war file the correct profile is activated but according to the documentation, prod should be activated by default based on the way I built it.
Any ideas?

Aerospark build (and running with PySpark)

I am having trouble building the Aerospark connector # https://github.com/aerospike/aerospark
I have created fresh Ubuntu box, installed JDK, SBT, Maven, Scala 2.10, and then followed the steps at the github page above. During the build i get this error and I am not sure which is the most direct way to build this properly....
[error] 1 error was encountered during merge
java.lang.RuntimeException: deduplicate: different file contents found in
the following: /opt/astools/aerospark/lib/aerospike-helper-java-
1.0.6.jar:META-INF/maven/com.aerospike/aerospike-client/pom.xml
/root/.m2/repository/com/aerospike/aerospike-helper-java/1.0.6/aerospike-
helper-java-1.0.6.jar:META-INF/maven/com.aerospike/aerospike-client/pom.xml
/root/.ivy2/cache/com.aerospike/aerospike-client/jars/aerospike-client
3.3.1.jar:META-INF/maven/com.aerospike/aerospike-client/pom.xml
Are there any updated instructions for building this - the git link in the instructions seems outdated incidentally.
As an aside, has anyone tried this with PySpark?
There was an issue with the build file which affected ubuntu. Can you pull the latest changes and go through the build process again?

Resources