app staging using maven - maven

I am building my war folder using
mvn clean install
And I am deploying the project using :
gcloud preview app deploy /{PATH}/appengine-staging/app.yaml /{PATH}/appengine-staging/index.yaml /{PATH}/appengine-staging/cron.yaml --version=version-7 --project=project1-test
The previous two steps requires the Staging yaml files using
appengine-java-sdk/bin/appcfg.sh stage <WAR-dir> <yaml-dir>
is there any way to do the staging step (without deploying ) using maven ?

Take a look at the recently released appengine-maven-plugin. You probably wish to use:
mvn clean package appengine:stage
Standard (Using) (Reference)
Flexible (Using) (Reference)

Related

Deploying mvn with multiple executibles on Cloud Run

I have a maven project structured:
/root
/CommonProject
/executable1
/executable2
/subroot
/subrootCommon
/...
So far I am trying to just deploy executable1.
I wanted to the project to use Java 19, I am fine with Java 17 if it's easier.
When I activate cloud shell, I am able to:
Change $JAVA_HOME to jdk 17
clone project
maven package it
run it in cloud shell.
However my project has no mapping for "/", just specific endpoints like "/test/hello" and I do not see anything in WebPreview on port 8080.
I have tried different ways to deploy, I am not familiar enough with Docker, so I tried CloudRun with Cloud Build with trigger from Source.
Here lies my current problem - every build has failed so far. It is using jdk 11 which is a problem (or at least one of them).
I have tried also adding cloudbuild.yaml or local Dockerfile just to deploy jar built manually, but I am still failing.
+FROM openjdk:17
+COPY root/target/executable1-1.0-SNAPSHOT-jar-with-dependencies.jar /home/user/var/run/executable1.jar
+CMD ["java", "-jar", "/home/user/var/run/executable1.jar"]
I have done the same steps to deploy, which were shown in how-to-guides or available online labs, so I think the issue is with the fact that maybe buildpacks do not process correctly projects with dependencies?
executable1 and executable2 depend on CommonProject. Do I need to split my big maven project into separate projects, to build each of them individually?
I have tried Dockerfile, cloudbuild.yaml, something like project.toml.
I would like to deploy for now just 1 project, at one point in the future all executable projects from this maven.

Error: Could not find or load main class com.networknt.server.Server error

I have a quick question. Do you have a light-4j framework docker image hosted somewhere in which I can just add my API jar and run docker? I am getting a hard time running my APIs generated using codegen CLI in docker. It consistently gives me Error: Could not find or load main class com.networknt.server.Server error
Have you tried mvn clean install exec:exec? If you want to run with the jar file, you need to build with mvn clean install -Prelease to generate the final fat jar.
This is one of the features contributed by one of the members to speed up the testing cycle to avoid building all extra artifacts for each cycle. It might confuse new developers, though. The generated README.md has some information on how to build and start. Let me know it is not clear, and I will add extra info. When you run the build.sh to generate a docker image, it will be built with -Prelease in the script.

What's the recommended way of building ELKI's current development status?

I forked ELKI from https://github.com/elki-project because I want to keep up to date with the latest development status while making my own changes and additions to the source (which I will possibly provide via pull request if it's sensible).
I followed the instructions in the README.md to package it with mvn package but there was no .jar created in elki/target/ - when checking out the release0.7.1 branch, it worked and I could start the minigui with java -cp elki-0.7.1.jar de.lmu.ifi.dbs.elki.application.ELKILauncher.
Is there a recommended way to try out the latest changes on the master?
We are currently in the process of modularizing ELKI.
But mvn package does create .jar files in elki/target/ here:
elki/target/elki-0.7.2-SNAPSHOT.jar
elki/target/elki-0.7.2-SNAPSHOT-javadoc.jar
elki/target/elki-0.7.2-SNAPSHOT-sources.jar
elki/target/dependency/elki-core-dbids-0.7.2-SNAPSHOT.jar
elki/target/dependency/elki-core-dbids-int-0.7.2-SNAPSHOT.jar
elki/target/dependency/elki-core-util-0.7.2-SNAPSHOT.jar
elki/target/dependency/elki-docutil-0.7.2-SNAPSHOT.jar
elki/target/dependency/elki-logging-0.7.2-SNAPSHOT.jar
elki/target/dependency/hamcrest-core-1.3.jar
elki/target/dependency/javaparser-core-2.3.0.jar
elki/target/dependency/junit-4.12.jar
elki/target/dependency/trove4j-3.0.3.jar
The main jar, ./elki/target/elki-0.7.2-SNAPSHOT.jar is runnable, but will only include the command line interface because of modularization - the minigui is optional now.
If you want a all-in-one bundle (as distributed on the web site), you need to enable the Maven profile bundle in addition to the functionality you want to include (e.g. mvn -Psvg,svm,uncertain,bundle package).

Is there a Maven way to deploy a Java App (not a WebApp)?

I am developing a simple command line application. I would like to use CloudBees to:
Git repo (OK, even a private one)
Jenkins Continuous Build (OK, trigger the build when I push to the repo, perfect)
Deploy to RUN#Cloud (OK, but painful SDK installation)
My question would be: is there a way to deploy a Java App (not a Web App) with the Maven CloudBees plugin ? (It is also to record my experience).
Running a raw Java container is documented: http://developer.cloudbees.com/bin/view/RUN/Java+Container
The bees-maven-plugin is documented here: https://developer.cloudbees.com/bin/view/RUN/MavenGuide . But the plugin does not seems to do all what the SDK can do. So I couldn't use it in Jenkins.
What I did is adding a "Script Shell / Post build step" in the Jenkins job. With the following script:
. /private/brnvrn/scripts/setup-sdk
bees app:deploy -a brnvrn/gdataaccess -t java -R class=com.brnvrn.test.Main -R classpath=gdataaccess.jar target/gdataaccess-1.0-SNAPSHOT.jar waitForApplicationStart=false
How to install the SDK in Jenkins is explained here: http://wiki.cloudbees.com/bin/view/DEV/Scripting+Bees+SDK+in+Jenkins and here is how to mount DAV directory: http://wiki.cloudbees.com/bin/view/DEV/Mounting+DAV+Repositories. (Just be aware that the files you upload in /private/ will be available in /private/$account_name/ ...
I managed to make it work and then realized that there is really no point to deploy a command line App to RUN#Cloud. Still I would like to known if the bees-maven-plugin would be able to do the job without all the SDK installation trouble.
The CloudBees maven plugin only supports deployment of WAR files. As an alternative, you can use the CloudBees Deployer plugin for Jenkins to setup a post-build action to deploy the JAR artifact (this is pre-installed in DEV#cloud Jenkins instances). You can also use the CloudBees SDK to deploy your JAR artifact (bees app:deploy -a APPID JAR_FILE)

deploy maven application in JBoss not work

I'm developing my first maven application and now i have this trouble, i performed the following commands
mvn compile
mvn package
mvn jboss-as-deploy
the deploy process ends without errors but in my JBOSS_HOME\standalone\deployments i don't find the .war
why?
Try to set targetDir option (maybe the default is overriden in your environoment?). See http://docs.jboss.org/jbossas/7/plugins/maven/latest/deploy-mojo.html.
The $JBOSS_HOME/standalone/deployments directory is not where deployments are stored. If you look in that directory there is a README file that explains it's what the directory is used for.
The jboss-as-maven-plugin uses the deployment API's to deploy the content to the server. This generally ends up in $JBOSS_HOME/standalone/data/content for a standalone server. Though you really shouldn't be doing anything with files in that directory.

Resources