How can I create a Java(Maven) Application as a CICD Project on gitlab with windows and with a shell runner. Is it right manner? When I search this subject, I see a java/CICD Project or a Maven/CICD Project , but not a CICD Project where the java aplication which build within maven.
Here an example that how you can;
image: adoptopenjdk/maven-openjdk11
build:
script: "mvn clean install"
Related
Basic Spring Boot app with Gradle.
If I build locally with Gradle using
./gradlew clean build
my jar is in
build/
But when using GitLab's pipelines with the following config
gradle-build:
image: gradle:alpine
stage: build
script:
- ./gradlew clean build
artifacts:
paths:
- build/libs/*.jar
The jar is in
build/libs
The "artifacts -> paths" config is just to share the jar with the next step of the pipeline, which is building the docker container.
So why the difference between the 2 ?
I like to have consistency and have the same thing locally as on the build server.
Thanks.
How to get started with java S2I build for spring boot application with Gradle build?
Please suggest me any Json/yml file needs to be imported to get started.
Here is a whole repo - https://github.com/dsevost/gradle-s2i - with a Dockerfile to build a S2I gradle builder image, and a template to build applications on top of it.
Perhaps it is worth noting the BUILDER parameter in the template with possible values of 'Gradle' or 'Maven'. According to the assemble script, it will build a gradle project even when both pom.xml and build.gradle are present in the project directory.
I haven't tried it myself but I glanced over the template and it looks OK...assuming the image and S2I scripts are functional.
I have setup a multi module spring boot application including Google appengine integration. Locally everything works fine.
If I do a clean checkout of my GIT repo and after that execute
mvn clean install
mvn appengine:deploy
The app gets properly deployed to Google appengine
If I try to do the same on gitlab using the following deploy pipeline
deploy-prod:
stage: deploy
image: $CI_REGISTRY_IMAGE/build
when: manual
environment: prod
script:
- 'mvn clean install'
- 'mvn appengine:deploy'
I get an error saying:
Failed to execute goal on project XXX: Could not resolve dependencies
for project YYY:XXX:war:0.0.1-SNAPSHOT: Could not find artifact
YYY:XXX:jar:0.0.1-SNAPSHOT
Do you have any idea what is wrong/different here? Never had such problems on Gitlab? And I have no idea what is different to the case when I do a clean checkout locally and execute the same commands there?
Thanks for your help.
I assume, you are checking it at your local machine. But have you checked it with $CI_REGISTRY_IMAGE/build manually? I think there is an issue with the docker image itself.
I need help in configuring a jenkins job. I am able to deploy the code using mule mvn deploy command in a single job. Now i need to build the package and use the package to deploy it to multiple environments with out building it again. Can some one help me with that. I am able to package the code using mvn package. BUt when I want to deploy the build package I am using mvn deploy command and this is compiling and building the code. Am I missing something?
Usually, you would build the project and then deploy it to one Nexus/Artifactory. If you need it in different artifact repositories, you usually proxy the original repository in the other repository.
If you really need to deploy the same file to two Nexus/Artifactory, you can add additional deployments using the goals in the deploy plugin.
I am trying to use Jenkins and Selenium for CI with my Spring Project that I will be running in AS7.
I would like to know if I can get Jenkins to issue a "maven jboss-as:deploy" command line on my project to deploy it to my AS7 server.
Can someone please let me know if this can be done..
No need to involve Jenkins here. Just add the jboss-as:deploy plugin to your pom.xml, bound to the pre-integration-test phase of your build. Then when you run mvn install (either locally or on Jenkins), your war will be deployed to the AS7 server.